<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>ListWriter</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
MathJax = {
	tex: {
		inlineMath: '$', '$'], ['\\(', '\\)'
	},
	svg: {
		fontCache: 'global'
	}
};
</script>
<script type="text/javascript" id="MathJax-script" async
	src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js">
</script>

<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'ListWriter' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../extensions.html">Kits</a></li><li><a href="index.html">WorldModelKit</a></li><li><b>ListWriter</b></li></ul></div>
<p class="purpose">ListWriter  A flexible object-lister taking care of plurals, inventory information, various formats and so on.</p>

<ul class="toc"><li><a href="lstwr.html#SP1">&#167;1. Specification</a></li><li><a href="lstwr.html#SP2">&#167;2. Memory</a></li><li><a href="lstwr.html#SP3">&#167;3. WriteListOfMarkedObjects</a></li><li><a href="lstwr.html#SP4">&#167;4. List Number and Gender</a></li><li><a href="lstwr.html#SP5">&#167;5. List Writer Regard Storage</a></li><li><a href="lstwr.html#SP6">&#167;6. Response Printing</a></li><li><a href="lstwr.html#SP7">&#167;7. About Iterator Functions</a></li><li><a href="lstwr.html#SP8">&#167;8. Tracing</a></li><li><a href="lstwr.html#SP9">&#167;9. Marked List Iterator</a></li><li><a href="lstwr.html#SP10">&#167;10. Concealment</a></li><li><a href="lstwr.html#SP11">&#167;11. Having Evident Content</a></li><li><a href="lstwr.html#SP12">&#167;12. Coalesce Marked List</a></li><li><a href="lstwr.html#SP13">&#167;13. Object Tree Iterator</a></li><li><a href="lstwr.html#SP14">&#167;14. Coalesce Object Tree</a></li><li><a href="lstwr.html#SP15">&#167;15. GroupChildren</a></li><li><a href="lstwr.html#SP16">&#167;16. WriteListFrom</a></li><li><a href="lstwr.html#SP17">&#167;17. Standard Contents Listing Rule</a></li><li><a href="lstwr.html#SP18">&#167;18. Partitioning</a></li><li><a href="lstwr.html#SP19">&#167;19. Partition List</a></li><li><a href="lstwr.html#SP20">&#167;20. Equivalence Relation</a></li><li><a href="lstwr.html#SP21">&#167;21. Grouping</a></li><li><a href="lstwr.html#SP22">&#167;22. Write List Recursively</a></li><li><a href="lstwr.html#SP23">&#167;23. Write Multiple Class Group</a></li><li><a href="lstwr.html#SP24">&#167;24. Write Single Class Group</a></li><li><a href="lstwr.html#SP25">&#167;25. Write After Entry</a></li><li><a href="lstwr.html#SP26">&#167;26. Internal Rule</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. Specification.</b>The list-writer is called by one of the following function calls:
</p>

<ul class="items"><li>(1) <span class="extract"><span class="extract-syntax">WriteListOfMarkedObjects(style)</span></span>, where the set of objects listed is
understood to be exactly those with the <span class="extract"><span class="extract-syntax">workflag2</span></span> attribute set, and
<ul class="items"><li>(a) the <span class="extract"><span class="extract-syntax">style</span></span> is a sum of <span class="extract"><span class="extract-syntax">*_BIT</span></span> constants as defined in "Definitions.i6t".
</li></ul>
<li>(2) <span class="extract"><span class="extract-syntax">WriteListFrom(obj, style, depth, noactivity, iterator)</span></span>, where only the
first two parameters are compulsory:
<ul class="items"><li>(a) the set of objects listed begins with <span class="extract"><span class="extract-syntax">obj</span></span>;
</li><li>(b) the <span class="extract"><span class="extract-syntax">style</span></span> is a sum of <span class="extract"><span class="extract-syntax">*_BIT</span></span> constants as defined in "Definitions.i6t";
</li><li>(c) the <span class="extract"><span class="extract-syntax">depth</span></span> is the recursion depth within the list &mdash; ordinarily 0, but
by supplying a higher value, we can simulate a sublist of another list;
</li><li>(d) <span class="extract"><span class="extract-syntax">noactivity</span></span> is a flag which forces the list-writer to ignore the
"listing the contents of" activity (in cases where it would otherwise consult
this): by default this is <span class="extract"><span class="extract-syntax">false</span></span>;
</li><li>(e) <span class="extract"><span class="extract-syntax">iterator</span></span> is an iterator function which provides the objects in sequence.
</li></ul>
</li></ul>
<p class="commentary"><span class="extract"><span class="extract-syntax">WriteListOfMarkedObjects</span></span> is simply a front-end which supplies suitable
parameters for <span class="extract"><span class="extract-syntax">WriteListFrom</span></span>.
</p>

<p class="commentary">The iterator function is by default <span class="extract"><span class="extract-syntax">ObjectTreeIterator</span></span>. This defines the
sequence of objects as being the children of the parent of <span class="extract"><span class="extract-syntax">obj</span></span>, in object
tree sequence (that is: <span class="extract"><span class="extract-syntax">child(parent(obj))</span></span> is first). Moreover, when using
<span class="extract"><span class="extract-syntax">ObjectTreeIterator</span></span>, the "listing the contents of" activity is carried out,
unless <span class="extract"><span class="extract-syntax">noactivity</span></span> is set.
</p>

<p class="commentary">We also provide the iterator function <span class="extract"><span class="extract-syntax">MarkedListIterator</span></span>, which defines
the sequence of objects as being the list in the word array
<span class="extract"><span class="extract-syntax">MarkedObjectArray</span></span> with length <span class="extract"><span class="extract-syntax">MarkedObjectLength</span></span>. Here the "listing
the contents of" activity is never used, since the objects are not
necessarily the contents of any single thing. This of course is the
iterator used by <span class="extract"><span class="extract-syntax">WriteListOfMarkedObjects(style)</span></span>: it works by filling
this array with all the objects having <span class="extract"><span class="extract-syntax">workflag2</span></span> set.
</p>

<p class="commentary">The full specification for iterator functions is given below.
</p>

<p class="commentary">The list-writer automatically groups adjacent and indistinguishable terms
in the sequence into plurals, and carries out the "printing the plural
name" activity to handle these. Doing this alone would result in text such
as "You can see a cake, three coins, an onion, and two coins here",
where the five coins are mentioned in two clauses because they happen not
to be adjacent in the list. The list-writer therefore carries out the activity
"grouping together" to see if the user would like to tie certain objects
together into a single entry: what this does is to set suitable <span class="extract"><span class="extract-syntax">list_together</span></span>
properties for the objects. Inform has already given plural objects a similar
<span class="extract"><span class="extract-syntax">list_together</span></span> property. The net effect is that any entries in the list with
a non-blank value of <span class="extract"><span class="extract-syntax">list_together</span></span> must be adjacent to each other.
</p>

<p class="commentary">We could achieve that by sorting the list in order of <span class="extract"><span class="extract-syntax">list_together</span></span> value,
but that would result in drastic movements, whereas we want to upset the
original ordering as little as possible. So instead we use a process called
{\it coalescing} the list. This is such that for every value \(L\neq 0\)
of <span class="extract"><span class="extract-syntax">list_together</span></span>, every entry with that value is moved back in the list
to follow the first entry with that value. Thus if the original order is
\(x_1, x_2, ..., x_N\) then \(x_j\) still precedes \(x_k\) in coalesced order
unless there exists \(i&lt;j&lt;k\) such that \(L(i) = L(k) \neq 0\) and \(L(j)\neq L(i)\).
This is as stable as it can be while achieving the "interval" property
that non-zero \(L\) values occur in contiguous runs.
</p>

<p class="commentary">We therefore obtain text such as "You can see a cake, five coins, the tiles
W, X, Y and Z from a Scrabble set, and an onion here." where the coins and
the Scrabble tiles have been coalesced together in the list.
</p>

<p class="commentary">It's important to note that the default <span class="extract"><span class="extract-syntax">ObjectTreeIterator</span></span> has the
side-effect of actually reordering the object tree: it rearranges the children
being listed so that they appear in the tree in coalesced order. The
<span class="extract"><span class="extract-syntax">MarkedListIterator</span></span> used by <span class="extract"><span class="extract-syntax">WriteListOfMarkedObjects</span></span> has the same
side-effect if the marked objects all happen to share a common parent.
It might seem odd for a list-writer to have side effects at all, but the
idea is that occasional coalescing improves the quality of play in many
small ways &mdash; for instance, the sequence of matches to TAKE ALL is tidier &mdash;
and that coalescing has a small speed cost, so we want to do it as little
as possible. (The latter was more of a consideration for I6: interpreters
are faster nowadays.)
</p>

<p class="commentary">This specification is somewhat stronger than that of the I6 library's
traditional list-writer, because
</p>

<ul class="items"><li>(i) it supports arbitrary lists of objects, not just children of specific
parents, while still allowing coalesced and grouped lists,
</li><li>(ii) it can be used recursively in all cases,
</li><li>(iii) it uses its own memory, rather than borrowing memory from the parser,
so that it can safely be used while the parser is working, and
</li><li>(iv) it manages this memory more flexibly and without silently failing by
buffer overruns on unexpectedly large lists.
</li></ul>
<p class="commentary">The I7 version of <span class="extract"><span class="extract-syntax">WriteListFrom</span></span>, when using <span class="extract"><span class="extract-syntax">ObjectTreeIterator</span></span>, differs
from the I6 version in that the object <span class="extract"><span class="extract-syntax">o</span></span> is required to be the <span class="extract"><span class="extract-syntax">child</span></span> of
its <span class="extract"><span class="extract-syntax">parent</span></span>, that is, to be the eldest child. (So in effect it's a function
of parents, not children, but we retain the form for familiarity's sake.)
In practice this was invariably the way <span class="extract"><span class="extract-syntax">WriteListFrom</span></span> was used even in
I6 days.
</p>

<p class="commentary">Finally, the <span class="extract"><span class="extract-syntax">ISARE_BIT</span></span> is differently interpreted in I7: instead of printing
something like " are ducks and drakes", as it would have done in I6, the
initial space is now suppressed and we instead print "are ducks and drakes".
</p>

<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. Memory.</b>The list-writer needs to dynamically allocate temporary array space of a known
size, in such a way that the array is effectively on the local stack frame:
if only either the Z-machine or Glulx supported a stack in memory, this would
be no problem, but they do not and we must therefore use the following.
</p>

<p class="commentary">The size of the stack is such that it can support a list which includes every
object and recurses in turn to most other objects: in practice, this never
happens. It would be nice to allocate more just in case, but the Z-machine is
desperately short of array memory.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">REQUISITION_STACK_SIZE</span><span class="plain-syntax"> = </span><span class="constant-syntax">3</span><span class="plain-syntax">*</span><span class="identifier-syntax">ICOUNT_OBJECT</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Array</span><span class="plain-syntax"> </span><span class="identifier-syntax">requisition_stack</span><span class="plain-syntax"> --&gt; </span><span class="identifier-syntax">REQUISITION_STACK_SIZE</span><span class="plain-syntax">;</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">requisition_stack_pointer</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">RequisitionStack</span><span class="plain-syntax"> </span><span class="identifier-syntax">len</span><span class="plain-syntax"> </span><span class="identifier-syntax">top</span><span class="plain-syntax"> </span><span class="identifier-syntax">addr</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">top</span><span class="plain-syntax"> = </span><span class="identifier-syntax">requisition_stack_pointer</span><span class="plain-syntax"> + </span><span class="identifier-syntax">len</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">top</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">REQUISITION_STACK_SIZE</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="reserved-syntax">false</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">addr</span><span class="plain-syntax"> = </span><span class="identifier-syntax">requisition_stack</span><span class="plain-syntax"> + </span><span class="identifier-syntax">requisition_stack_pointer</span><span class="plain-syntax">*</span><span class="identifier-syntax">WORDSIZE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="comment-syntax">print "Allocating ", addr, " at pointer ", requisition_stack_pointer, "^";</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">requisition_stack_pointer</span><span class="plain-syntax"> = </span><span class="identifier-syntax">top</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">addr</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">FreeStack</span><span class="plain-syntax"> </span><span class="identifier-syntax">addr</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">addr</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">requisition_stack_pointer</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">addr</span><span class="plain-syntax"> - </span><span class="identifier-syntax">requisition_stack</span><span class="plain-syntax">)/</span><span class="identifier-syntax">WORDSIZE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. WriteListOfMarkedObjects.</b>This routine will use the <span class="extract"><span class="extract-syntax">MarkedListIterator</span></span>. That means it has to create
an array containing the object numbers of every object with the <span class="extract"><span class="extract-syntax">workflag2</span></span>
attribute set, placing the address of this array in <span class="extract"><span class="extract-syntax">MarkedObjectArray</span></span> and
the length in <span class="extract"><span class="extract-syntax">MarkedObjectLength</span></span>. Note that we preserve any existing
marked list on the stack (using the assembly-language instructions <span class="extract"><span class="extract-syntax">@push</span></span>
and <span class="extract"><span class="extract-syntax">@pull</span></span>) for the duration of our use.
</p>

<p class="commentary">While the final order of this list will depend on what it looks like after
coalescing, the initial order is also important. If all of the objects have
a common parent in the object tree, then we coalesce those objects and
place the list in object tree order. But if not, we place the list in
object number order (which is essentially the order of traversal of the
initial state of the object tree: thus objects in Room A will all appear
before objects in Room B if A was created before B in the source text).
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">MarkedObjectArray</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">MarkedObjectLength</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>

<span class="plain-syntax">+</span><span class="identifier-syntax">replacing</span><span class="plain-syntax">(</span><span class="identifier-syntax">from</span><span class="plain-syntax"> </span><span class="identifier-syntax">BasicInformKit</span><span class="plain-syntax">) [ </span><span class="identifier-syntax">WriteListOfMarkedObjects</span><span class="plain-syntax"> </span><span class="identifier-syntax">in_style</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="identifier-syntax">common_parent</span><span class="plain-syntax"> </span><span class="identifier-syntax">first</span><span class="plain-syntax"> </span><span class="identifier-syntax">mixed_parentage</span><span class="plain-syntax"> </span><span class="identifier-syntax">length</span><span class="plain-syntax"> </span><span class="identifier-syntax">g</span><span class="plain-syntax"> </span><span class="identifier-syntax">gc</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">gc</span><span class="plain-syntax"> = -2;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">objectloop</span><span class="plain-syntax"> (</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="reserved-syntax">ofclass</span><span class="plain-syntax"> </span><span class="identifier-syntax">Object</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">workflag2</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">length</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">first</span><span class="plain-syntax"> == </span><span class="reserved-syntax">nothing</span><span class="plain-syntax">) { </span><span class="identifier-syntax">first</span><span class="plain-syntax"> = </span><span class="identifier-syntax">obj</span><span class="plain-syntax">; </span><span class="identifier-syntax">common_parent</span><span class="plain-syntax"> = </span><span class="reserved-syntax">parent</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">); }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> { </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="reserved-syntax">parent</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">) ~= </span><span class="identifier-syntax">common_parent</span><span class="plain-syntax">) </span><span class="identifier-syntax">mixed_parentage</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">g</span><span class="plain-syntax"> = </span><span class="identifier-syntax">GetGNAOfObject</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">); </span><span class="identifier-syntax">g</span><span class="plain-syntax"> = </span><span class="identifier-syntax">g</span><span class="plain-syntax">%3;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">gc</span><span class="plain-syntax"> == -2) </span><span class="identifier-syntax">gc</span><span class="plain-syntax"> = </span><span class="identifier-syntax">g</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">gc</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">g</span><span class="plain-syntax">) </span><span class="identifier-syntax">gc</span><span class="plain-syntax"> = -1;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">mixed_parentage</span><span class="plain-syntax">) </span><span class="identifier-syntax">common_parent</span><span class="plain-syntax"> = </span><span class="reserved-syntax">nothing</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">length</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">in_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">ISARE_BIT</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'W'</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">in_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">CFIRSTART_BIT</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'X'</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'Y'</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">MarkedObjectArray</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">MarkedObjectLength</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">MarkedObjectArray</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RequisitionStack</span><span class="plain-syntax">(</span><span class="identifier-syntax">length</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">MarkedObjectLength</span><span class="plain-syntax"> = </span><span class="identifier-syntax">length</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">MarkedObjectArray</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">IssueRTP</span><span class="plain-syntax">(</span><span class="string-syntax">"ListWriterRanOutOfMemory"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="string-syntax">"The list-writer has run out of memory.^"</span><span class="plain-syntax">, </span><span class="identifier-syntax">BasicInformKitRTPs</span><span class="plain-syntax">);</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">common_parent</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">ObjectTreeCoalesce</span><span class="plain-syntax">(</span><span class="reserved-syntax">child</span><span class="plain-syntax">(</span><span class="identifier-syntax">common_parent</span><span class="plain-syntax">));</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">length</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">objectloop</span><span class="plain-syntax"> (</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="reserved-syntax">in</span><span class="plain-syntax"> </span><span class="identifier-syntax">common_parent</span><span class="plain-syntax">) </span><span class="comment-syntax">object tree order</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">workflag2</span><span class="plain-syntax">) </span><span class="identifier-syntax">MarkedObjectArray</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">length</span><span class="plain-syntax">++ = </span><span class="identifier-syntax">obj</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">length</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">objectloop</span><span class="plain-syntax"> (</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="reserved-syntax">ofclass</span><span class="plain-syntax"> </span><span class="identifier-syntax">Object</span><span class="plain-syntax">) </span><span class="comment-syntax">object number order</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">workflag2</span><span class="plain-syntax">) </span><span class="identifier-syntax">MarkedObjectArray</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">length</span><span class="plain-syntax">++ = </span><span class="identifier-syntax">obj</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>

<span class="plain-syntax">        </span><span class="identifier-syntax">WriteListFrom</span><span class="plain-syntax">(</span><span class="identifier-syntax">first</span><span class="plain-syntax">, </span><span class="identifier-syntax">in_style</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="reserved-syntax">false</span><span class="plain-syntax">, </span><span class="identifier-syntax">MarkedListIterator</span><span class="plain-syntax">);</span>

<span class="plain-syntax">        </span><span class="identifier-syntax">FreeStack</span><span class="plain-syntax">(</span><span class="identifier-syntax">MarkedObjectArray</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">MarkedObjectLength</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">MarkedObjectArray</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">prior_named_list</span><span class="plain-syntax"> = </span><span class="identifier-syntax">length</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">prior_named_list_gender</span><span class="plain-syntax"> = </span><span class="identifier-syntax">gc</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. List Number and Gender.</b>As a brief parenthesis, the same algorithm can be used to work out the
prior named list number and gender for everything matching a description.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">RegardingMarkedObjects</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="identifier-syntax">length</span><span class="plain-syntax"> </span><span class="identifier-syntax">g</span><span class="plain-syntax"> </span><span class="identifier-syntax">gc</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">gc</span><span class="plain-syntax"> = -2;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">objectloop</span><span class="plain-syntax"> (</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="reserved-syntax">ofclass</span><span class="plain-syntax"> </span><span class="identifier-syntax">Object</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">workflag2</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">length</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">g</span><span class="plain-syntax"> = </span><span class="identifier-syntax">GetGNAOfObject</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">); </span><span class="identifier-syntax">g</span><span class="plain-syntax"> = </span><span class="identifier-syntax">g</span><span class="plain-syntax">%3;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">gc</span><span class="plain-syntax"> == -2) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">gc</span><span class="plain-syntax"> = </span><span class="identifier-syntax">g</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">prior_named_noun</span><span class="plain-syntax"> = </span><span class="identifier-syntax">obj</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">gc</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">g</span><span class="plain-syntax">) </span><span class="identifier-syntax">gc</span><span class="plain-syntax"> = -1;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">prior_named_list</span><span class="plain-syntax"> = </span><span class="identifier-syntax">length</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">prior_named_list_gender</span><span class="plain-syntax"> = </span><span class="identifier-syntax">gc</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">length</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) { </span><span class="identifier-syntax">prior_named_noun</span><span class="plain-syntax"> = </span><span class="reserved-syntax">nothing</span><span class="plain-syntax">; </span><span class="identifier-syntax">prior_named_list_gender</span><span class="plain-syntax"> = -1; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">+</span><span class="identifier-syntax">replacing</span><span class="plain-syntax">(</span><span class="identifier-syntax">from</span><span class="plain-syntax"> </span><span class="identifier-syntax">BasicInformKit</span><span class="plain-syntax">) [ </span><span class="identifier-syntax">PNToVP</span><span class="plain-syntax"> </span><span class="identifier-syntax">gna</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">prior_named_noun</span><span class="plain-syntax"> == </span><span class="identifier-syntax">player</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">story_viewpoint</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">prior_named_noun</span><span class="plain-syntax">) </span><span class="identifier-syntax">gna</span><span class="plain-syntax"> = </span><span class="identifier-syntax">GetGNAOfObject</span><span class="plain-syntax">(</span><span class="identifier-syntax">prior_named_noun</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (((</span><span class="identifier-syntax">gna</span><span class="plain-syntax">%6)/3 == </span><span class="constant-syntax">1</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">prior_named_list</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">2</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">6</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">3</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. List Writer Regard Storage.</b>This is somewhat hacky, but enables "[regarding list writer internals]".
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">Array</span><span class="plain-syntax"> </span><span class="identifier-syntax">LWI_Storage</span><span class="plain-syntax"> --&gt; </span><span class="constant-syntax">1</span><span class="plain-syntax"> (-1) </span><span class="reserved-syntax">nothing</span><span class="plain-syntax">;</span>
<span class="plain-syntax">[ </span><span class="identifier-syntax">SetLWI</span><span class="plain-syntax"> </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">b</span><span class="plain-syntax"> </span><span class="identifier-syntax">c</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LWI_Storage</span><span class="plain-syntax">--&gt;0 = </span><span class="identifier-syntax">a</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LWI_Storage</span><span class="plain-syntax">--&gt;1 = </span><span class="identifier-syntax">b</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LWI_Storage</span><span class="plain-syntax">--&gt;2 = </span><span class="identifier-syntax">c</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
<span class="plain-syntax">[ </span><span class="identifier-syntax">RegardingLWI</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">prior_named_list</span><span class="plain-syntax"> = </span><span class="identifier-syntax">LWI_Storage</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">prior_named_list_gender</span><span class="plain-syntax"> = </span><span class="identifier-syntax">LWI_Storage</span><span class="plain-syntax">--&gt;1;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">prior_named_noun</span><span class="plain-syntax"> = </span><span class="identifier-syntax">LWI_Storage</span><span class="plain-syntax">--&gt;2;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. Response Printing.</b>From which:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">ResponseViaActivity</span><span class="plain-syntax"> </span><span class="identifier-syntax">R</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">prior_named_noun</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">prior_named_list</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">prior_named_list_gender</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">RegardingSingleObject</span><span class="plain-syntax">(</span><span class="reserved-syntax">nothing</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">CarryOutActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">PRINTING_RESPONSE_ACT</span><span class="plain-syntax">, </span><span class="identifier-syntax">R</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">prior_named_list_gender</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">prior_named_list</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">prior_named_noun</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP7" class="paragraph-anchor"></a><b>&#167;7. About Iterator Functions.</b>Suppose <span class="extract"><span class="extract-syntax">Iter</span></span> is an iterator function and that we have a "raw list"
\(x_1, x_2, ..., x_n\) of objects. Of these, the iterator function will
choose a sublist of "qualifying" objects. It is called with arguments
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">Iter</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">, </span><span class="identifier-syntax">depth</span><span class="plain-syntax">, </span><span class="identifier-syntax">L</span><span class="plain-syntax">, </span><span class="identifier-syntax">function</span><span class="plain-syntax">)</span>
</pre>
<p class="commentary">where the <span class="extract"><span class="extract-syntax">obj</span></span> is required to be \(x_j\) for some \(j\) and the function is one
of the <span class="extract"><span class="extract-syntax">*_ITF</span></span> constants defined below:
</p>

<ul class="items"><li>(a) On <span class="extract"><span class="extract-syntax">START_ITF</span></span>, we return \(x_1\), or <span class="extract"><span class="extract-syntax">nothing</span></span> if the list is empty.
</li><li>(b) On <span class="extract"><span class="extract-syntax">SEEK_ITF</span></span>, we return the smallest \(k\geq j\) such that \(x_k\) qualifies,
or <span class="extract"><span class="extract-syntax">nothing</span></span> if none of \(x_j, x_{j+1}, ..., x_n\) qualify.
</li><li>(c) On <span class="extract"><span class="extract-syntax">ADVANCE_ITF</span></span>, we return the smallest \(k &gt; j\) such that \(x_k\) qualifies,
or <span class="extract"><span class="extract-syntax">nothing</span></span> if none of \(x_{j+1}, x_{j+2} ..., x_n\) qualify.
</li><li>(d) On <span class="extract"><span class="extract-syntax">COALESCE_ITF</span></span>, we coalesce the entire list (not merely the qualifying
entries) and return the new \(x_1\), or <span class="extract"><span class="extract-syntax">nothing</span></span> if the list is empty.
</li></ul>
<p class="commentary">Thus, given any \(x_i\), we can produce the sublist of qualifying entries by
performing <span class="extract"><span class="extract-syntax">START_ITF</span></span> on \(x_i\), then <span class="extract"><span class="extract-syntax">SEEK_ITF</span></span>, to produce \(q_1\); then
<span class="extract"><span class="extract-syntax">ADVANCE_ITF</span></span> to produce \(q_2\), and so on until <span class="extract"><span class="extract-syntax">nothing</span></span> is returned, when
there are no more qualifying entries. <span class="extract"><span class="extract-syntax">SEEK_ITF</span></span> and <span class="extract"><span class="extract-syntax">ADVANCE_ITF</span></span> always
return qualifying objects, or <span class="extract"><span class="extract-syntax">nothing</span></span>; but <span class="extract"><span class="extract-syntax">START_ITF</span></span> and <span class="extract"><span class="extract-syntax">COALESCE_ITF</span></span>
may return a non-qualifying object, since there's no reason why \(x_1\) should
qualify in any ordering.
</p>

<p class="commentary">The iterator can make its own choice of which entries qualify, and of what
the raw list is; <span class="extract"><span class="extract-syntax">depth</span></span> is supplied to help in that decision. But if <span class="extract"><span class="extract-syntax">L</span></span>
is non-zero then the iterator is required to disqualify any entry whose
<span class="extract"><span class="extract-syntax">list_together</span></span> value is not <span class="extract"><span class="extract-syntax">L</span></span>.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">SEEK_ITF</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">ADVANCE_ITF</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">COALESCE_ITF</span><span class="plain-syntax"> = </span><span class="constant-syntax">2</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">START_ITF</span><span class="plain-syntax"> = </span><span class="constant-syntax">3</span><span class="plain-syntax">;</span>
</pre>
<p class="commentary firstcommentary"><a id="SP8" class="paragraph-anchor"></a><b>&#167;8. Tracing.</b>Uncomment this line and rebuild the kit to enable tracing of what the algorithm
below is doing. (This constant should not be used anywhere except in this file,
where <span class="extract"><span class="extract-syntax">#Ifdef</span></span> on it will have the expected effect: elsewhere, it might not.)
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="comment-syntax">Constant LKTRACE_LIST_WRITER;</span>
</pre>
<p class="commentary firstcommentary"><a id="SP9" class="paragraph-anchor"></a><b>&#167;9. Marked List Iterator.</b>Here the raw list is provided by the <span class="extract"><span class="extract-syntax">MarkedObjectArray</span></span>, which is convenient
for coalescing, but not so helpful for translating the <span class="extract"><span class="extract-syntax">obj</span></span> parameter into
the \(i\) such that it is \(x_i\). We simply search from the beginning to do
this, which combined with other code using the iterator makes for some
unnecessary \(O(n^2)\) calculations. But it saves memory and nuisance, and the
iterator is used only with printing to the screen, which never needs to be
very rapid anyway (because the player can only read very slowly).
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">MarkedListIterator</span><span class="plain-syntax"> </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="identifier-syntax">depth</span><span class="plain-syntax"> </span><span class="identifier-syntax">required_lt</span><span class="plain-syntax"> </span><span class="identifier-syntax">function</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> == </span><span class="reserved-syntax">nothing</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="reserved-syntax">nothing</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">required_lt</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">required_lt</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EMPTY_TEXT_VALUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax">(</span><span class="identifier-syntax">function</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">START_ITF</span><span class="plain-syntax">: </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">MarkedObjectArray</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">COALESCE_ITF</span><span class="plain-syntax">: </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">MarkedListCoalesce</span><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">SEEK_ITF</span><span class="plain-syntax">, </span><span class="identifier-syntax">ADVANCE_ITF</span><span class="plain-syntax">:</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0: </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">MarkedObjectLength</span><span class="plain-syntax">: </span><span class="identifier-syntax">i</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">MarkedObjectArray</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="identifier-syntax">obj</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">function</span><span class="plain-syntax"> == </span><span class="identifier-syntax">ADVANCE_ITF</span><span class="plain-syntax">) </span><span class="identifier-syntax">i</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (:</span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">MarkedObjectLength</span><span class="plain-syntax">: </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">                        </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> = </span><span class="identifier-syntax">MarkedObjectArray</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">LT_Compare</span><span class="plain-syntax">(</span><span class="identifier-syntax">required_lt</span><span class="plain-syntax">, </span><span class="identifier-syntax">EMPTY_TEXT_VALUE</span><span class="plain-syntax">) ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">                            (</span><span class="identifier-syntax">LT_Compare</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">.</span><span class="identifier-syntax">list_together</span><span class="plain-syntax">, </span><span class="identifier-syntax">required_lt</span><span class="plain-syntax">) ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">)) </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">WORKFLAG_BIT</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">depth</span><span class="plain-syntax">==0) &amp;&amp; (</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">workflag</span><span class="plain-syntax">))</span>
<span class="plain-syntax">                            </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">CONCEAL_BIT</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">ConcealedFromLists</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">))) </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">obj</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    }</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="reserved-syntax">nothing</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="reserved-syntax">nothing</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP10" class="paragraph-anchor"></a><b>&#167;10. Concealment.</b>This is the definition of concealment used by the list-writer, and means that,
for example, the "deciding the concealed possessions" activity is taken into
account.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">ConcealedFromLists</span><span class="plain-syntax"> </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="identifier-syntax">c</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">concealed</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">scenery</span><span class="plain-syntax">)) </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">c</span><span class="plain-syntax"> = </span><span class="reserved-syntax">parent</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">c</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> </span><span class="reserved-syntax">ofclass</span><span class="plain-syntax"> </span><span class="identifier-syntax">K5_container</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">K6_supporter</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">TestConcealment</span><span class="plain-syntax">(</span><span class="identifier-syntax">c</span><span class="plain-syntax">, </span><span class="identifier-syntax">obj</span><span class="plain-syntax">))) </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP11" class="paragraph-anchor"></a><b>&#167;11. Having Evident Content.</b>This is true when something has at least one unconcealed thing in it.
It's false when something is truly empty or when all the things in
it are concealed or undescribed, and is used to ensure that output
is consistent in both those cases. The player shouldn't count for
these purposes, but since the player is undescribed, they're excluded
anyway.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">ObviouslyOccupied</span><span class="plain-syntax"> </span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="identifier-syntax">x</span><span class="plain-syntax">;</span>
<span class="plain-syntax">  </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (~~((</span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="reserved-syntax">ofclass</span><span class="plain-syntax"> </span><span class="identifier-syntax">K5_container</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="reserved-syntax">ofclass</span><span class="plain-syntax"> </span><span class="identifier-syntax">K6_supporter</span><span class="plain-syntax">))) </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">  </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">container</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">open</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">transparent</span><span class="plain-syntax">) </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">; </span><span class="comment-syntax">opaque closed container's status can never be obvious</span>
<span class="plain-syntax">  </span><span class="identifier-syntax">x</span><span class="plain-syntax"> = </span><span class="reserved-syntax">child</span><span class="plain-syntax">(</span><span class="identifier-syntax">o</span><span class="plain-syntax">);</span>
<span class="plain-syntax">  </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="identifier-syntax">x</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">x</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">concealed</span><span class="plain-syntax">) &amp;&amp; (~~</span><span class="identifier-syntax">TestConcealment</span><span class="plain-syntax">(</span><span class="identifier-syntax">o</span><span class="plain-syntax">, </span><span class="identifier-syntax">x</span><span class="plain-syntax">))) </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">x</span><span class="plain-syntax"> = </span><span class="reserved-syntax">sibling</span><span class="plain-syntax">(</span><span class="identifier-syntax">x</span><span class="plain-syntax">);</span>
<span class="plain-syntax">  }</span>
<span class="plain-syntax">  </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP12" class="paragraph-anchor"></a><b>&#167;12. Coalesce Marked List.</b>The return value is the new first entry in the raw list.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">MarkedListCoalesce</span><span class="plain-syntax"> </span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">lt</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax"> </span><span class="identifier-syntax">swap</span><span class="plain-syntax"> </span><span class="identifier-syntax">m</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0: </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">MarkedObjectLength</span><span class="plain-syntax">: </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">lt</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">MarkedObjectArray</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">).</span><span class="identifier-syntax">list_together</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">LT_Compare</span><span class="plain-syntax">(</span><span class="identifier-syntax">lt</span><span class="plain-syntax">, </span><span class="identifier-syntax">EMPTY_TEXT_VALUE</span><span class="plain-syntax">) ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="comment-syntax">Find first object in list after contiguous run with this list_together value:</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">++: (</span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">MarkedObjectLength</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">                (</span><span class="identifier-syntax">LT_Compare</span><span class="plain-syntax">((</span><span class="identifier-syntax">MarkedObjectArray</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">).</span><span class="identifier-syntax">list_together</span><span class="plain-syntax">, </span><span class="identifier-syntax">lt</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">): </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) ;</span>
<span class="plain-syntax">            </span><span class="comment-syntax">If the contiguous run extends to end of list, the list is now perfect:</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="identifier-syntax">MarkedObjectLength</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">MarkedObjectArray</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">            </span><span class="comment-syntax">And otherwise we look to see if any future entries belong in the earlier run:</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax">=</span><span class="identifier-syntax">i</span><span class="plain-syntax">+1: </span><span class="identifier-syntax">l</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">MarkedObjectLength</span><span class="plain-syntax">: </span><span class="identifier-syntax">l</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">LT_Compare</span><span class="plain-syntax">((</span><span class="identifier-syntax">MarkedObjectArray</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">l</span><span class="plain-syntax">).</span><span class="identifier-syntax">list_together</span><span class="plain-syntax">, </span><span class="identifier-syntax">lt</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="comment-syntax">Yes, they do: so we perform a rotation to insert it before element i:</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">swap</span><span class="plain-syntax"> = </span><span class="identifier-syntax">MarkedObjectArray</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">l</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">m</span><span class="plain-syntax">=</span><span class="identifier-syntax">l</span><span class="plain-syntax">: </span><span class="identifier-syntax">m</span><span class="plain-syntax">&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">: </span><span class="identifier-syntax">m</span><span class="plain-syntax">--) </span><span class="identifier-syntax">MarkedObjectArray</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">m</span><span class="plain-syntax"> = </span><span class="identifier-syntax">MarkedObjectArray</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">m</span><span class="plain-syntax">-1);</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">MarkedObjectArray</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">swap</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="comment-syntax">And now the run is longer:</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">i</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="identifier-syntax">MarkedObjectLength</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">MarkedObjectArray</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">i</span><span class="plain-syntax">--;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">MarkedObjectArray</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP13" class="paragraph-anchor"></a><b>&#167;13. Object Tree Iterator.</b>Here the raw list is the list of all children of a given parent: since the
argument <span class="extract"><span class="extract-syntax">obj</span></span> is required to be a member of the raw list, we can use
<span class="extract"><span class="extract-syntax">parent(obj)</span></span> to find it. Now seeking and advancing are fast, but coalescing
is slower.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">list_filter_routine</span><span class="plain-syntax">;</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">ObjectTreeIterator</span><span class="plain-syntax"> </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="identifier-syntax">depth</span><span class="plain-syntax"> </span><span class="identifier-syntax">required_lt</span><span class="plain-syntax"> </span><span class="identifier-syntax">function</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> == </span><span class="reserved-syntax">nothing</span><span class="plain-syntax">) || (</span><span class="reserved-syntax">parent</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">) == </span><span class="reserved-syntax">nothing</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="reserved-syntax">nothing</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">function</span><span class="plain-syntax"> == </span><span class="identifier-syntax">START_ITF</span><span class="plain-syntax">) </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> = </span><span class="reserved-syntax">child</span><span class="plain-syntax">(</span><span class="reserved-syntax">parent</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">function</span><span class="plain-syntax"> == </span><span class="identifier-syntax">COALESCE_ITF</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">ObjectTreeCoalesce</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">function</span><span class="plain-syntax"> == </span><span class="identifier-syntax">ADVANCE_ITF</span><span class="plain-syntax">) </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> = </span><span class="reserved-syntax">sibling</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">required_lt</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">required_lt</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EMPTY_TEXT_VALUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (:: </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> = </span><span class="reserved-syntax">sibling</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> == </span><span class="reserved-syntax">nothing</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="reserved-syntax">nothing</span><span class="plain-syntax">;</span>
<span class="comment-syntax">f (function == ADVANCE_ITF) print "Considering ", (the) obj, ": ", (TEXT_TY_Say) obj.list_together, ": ", (TEXT_TY_Say) required_lt, ": ", ": ", (TEXT_TY_Say) lt_value, ": ", LT_Compare(obj.list_together, required_lt), "^";</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">LT_Compare</span><span class="plain-syntax">(</span><span class="identifier-syntax">required_lt</span><span class="plain-syntax">, </span><span class="identifier-syntax">EMPTY_TEXT_VALUE</span><span class="plain-syntax">) ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">LT_Compare</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">.</span><span class="identifier-syntax">list_together</span><span class="plain-syntax">, </span><span class="identifier-syntax">required_lt</span><span class="plain-syntax">) ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">)) </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">WORKFLAG_BIT</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">depth</span><span class="plain-syntax">==0) &amp;&amp; (</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">workflag</span><span class="plain-syntax">)) </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">list_filter_permits</span><span class="plain-syntax">) </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">CONCEAL_BIT</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">ConcealedFromLists</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">))) </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">obj</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP14" class="paragraph-anchor"></a><b>&#167;14. Coalesce Object Tree.</b>Again, the return value is the new first entry in the raw list.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">ObjectTreeCoalesce</span><span class="plain-syntax"> </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="identifier-syntax">memb</span><span class="plain-syntax"> </span><span class="identifier-syntax">lt</span><span class="plain-syntax"> </span><span class="identifier-syntax">later</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">LKTRACE_LIST_WRITER</span><span class="plain-syntax">; </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"^^Sorting out: "</span><span class="plain-syntax">; </span><span class="identifier-syntax">DiagnoseSortList</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">); #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    .</span><span class="identifier-syntax">StartAgain</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">memb</span><span class="plain-syntax"> = </span><span class="identifier-syntax">obj</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="identifier-syntax">memb</span><span class="plain-syntax"> ~= </span><span class="reserved-syntax">nothing</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="comment-syntax">Find the next object in a list_together run.</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">lt</span><span class="plain-syntax"> = </span><span class="identifier-syntax">memb</span><span class="plain-syntax">.</span><span class="identifier-syntax">list_together</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">LT_Compare</span><span class="plain-syntax">(</span><span class="identifier-syntax">lt</span><span class="plain-syntax">, </span><span class="identifier-syntax">EMPTY_TEXT_VALUE</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">memb</span><span class="plain-syntax"> = </span><span class="reserved-syntax">sibling</span><span class="plain-syntax">(</span><span class="identifier-syntax">memb</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="comment-syntax">Find first object after the contiguous run with this list_together value:</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">memb</span><span class="plain-syntax">=</span><span class="reserved-syntax">sibling</span><span class="plain-syntax">(</span><span class="identifier-syntax">memb</span><span class="plain-syntax">):</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">memb</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">LT_Compare</span><span class="plain-syntax">(</span><span class="identifier-syntax">memb</span><span class="plain-syntax">.</span><span class="identifier-syntax">list_together</span><span class="plain-syntax">, </span><span class="identifier-syntax">lt</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">): </span><span class="identifier-syntax">memb</span><span class="plain-syntax"> = </span><span class="reserved-syntax">sibling</span><span class="plain-syntax">(</span><span class="identifier-syntax">memb</span><span class="plain-syntax">)) ;</span>
<span class="plain-syntax">        </span><span class="comment-syntax">If the contiguous run extends to end of list, the list is now perfect:</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">memb</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">obj</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="comment-syntax">And otherwise we look to see if any future entries belong in the run:</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">later</span><span class="plain-syntax">=</span><span class="reserved-syntax">sibling</span><span class="plain-syntax">(</span><span class="identifier-syntax">memb</span><span class="plain-syntax">): </span><span class="identifier-syntax">later</span><span class="plain-syntax">: </span><span class="identifier-syntax">later</span><span class="plain-syntax">=</span><span class="reserved-syntax">sibling</span><span class="plain-syntax">(</span><span class="identifier-syntax">later</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">LT_Compare</span><span class="plain-syntax">(</span><span class="identifier-syntax">later</span><span class="plain-syntax">.</span><span class="identifier-syntax">list_together</span><span class="plain-syntax">, </span><span class="identifier-syntax">lt</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="comment-syntax">Yes, they do: so we perform a regrouping of the list and start again:</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> = </span><span class="identifier-syntax">GroupChildren</span><span class="plain-syntax">(</span><span class="reserved-syntax">parent</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">), </span><span class="identifier-syntax">lt</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">LKTRACE_LIST_WRITER</span><span class="plain-syntax">; </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"^^Sorted to: "</span><span class="plain-syntax">; </span><span class="identifier-syntax">DiagnoseSortList</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">); #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">StartAgain</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="comment-syntax">No, that run is complete. Continue with the element that followed the run.</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">obj</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP15" class="paragraph-anchor"></a><b>&#167;15. GroupChildren.</b>The following runs through the child-objects of <span class="extract"><span class="extract-syntax">par</span></span> in the I6 object tree,
and moves those having a given <span class="extract"><span class="extract-syntax">list_property</span></span> property value together, to
become the eldest children. It preserves the ordering in between those
objects, and also in between those not having that property value.
</p>

<p class="commentary">We do this by temporarily moving objects into and out of <span class="extract"><span class="extract-syntax">in_obj</span></span> and <span class="extract"><span class="extract-syntax">out_obj</span></span>,
objects which in all other circumstances never have children in the tree.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">GroupChildren</span><span class="plain-syntax"> </span><span class="identifier-syntax">par</span><span class="plain-syntax"> </span><span class="identifier-syntax">value</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="reserved-syntax">child</span><span class="plain-syntax">(</span><span class="identifier-syntax">par</span><span class="plain-syntax">) ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">LT_Compare</span><span class="plain-syntax">(</span><span class="reserved-syntax">child</span><span class="plain-syntax">(</span><span class="identifier-syntax">par</span><span class="plain-syntax">).</span><span class="identifier-syntax">list_together</span><span class="plain-syntax">, </span><span class="identifier-syntax">value</span><span class="plain-syntax">) ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">move</span><span class="plain-syntax"> </span><span class="reserved-syntax">child</span><span class="plain-syntax">(</span><span class="identifier-syntax">par</span><span class="plain-syntax">) </span><span class="reserved-syntax">to</span><span class="plain-syntax"> </span><span class="identifier-syntax">out_obj</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">move</span><span class="plain-syntax"> </span><span class="reserved-syntax">child</span><span class="plain-syntax">(</span><span class="identifier-syntax">par</span><span class="plain-syntax">) </span><span class="reserved-syntax">to</span><span class="plain-syntax"> </span><span class="identifier-syntax">in_obj</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="reserved-syntax">child</span><span class="plain-syntax">(</span><span class="identifier-syntax">in_obj</span><span class="plain-syntax">) ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">)  </span><span class="reserved-syntax">move</span><span class="plain-syntax"> </span><span class="reserved-syntax">child</span><span class="plain-syntax">(</span><span class="identifier-syntax">in_obj</span><span class="plain-syntax">) </span><span class="reserved-syntax">to</span><span class="plain-syntax"> </span><span class="identifier-syntax">par</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="reserved-syntax">child</span><span class="plain-syntax">(</span><span class="identifier-syntax">out_obj</span><span class="plain-syntax">) ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">move</span><span class="plain-syntax"> </span><span class="reserved-syntax">child</span><span class="plain-syntax">(</span><span class="identifier-syntax">out_obj</span><span class="plain-syntax">) </span><span class="reserved-syntax">to</span><span class="plain-syntax"> </span><span class="identifier-syntax">par</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="reserved-syntax">child</span><span class="plain-syntax">(</span><span class="identifier-syntax">par</span><span class="plain-syntax">);</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">#</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">LKTRACE_LIST_WRITER</span><span class="plain-syntax">;</span>
<span class="plain-syntax">[ </span><span class="identifier-syntax">DiagnoseSortList</span><span class="plain-syntax"> </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="identifier-syntax">memb</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">memb</span><span class="plain-syntax">=</span><span class="identifier-syntax">obj</span><span class="plain-syntax">: </span><span class="identifier-syntax">memb</span><span class="plain-syntax">~=</span><span class="reserved-syntax">nothing</span><span class="plain-syntax">: </span><span class="identifier-syntax">memb</span><span class="plain-syntax">=</span><span class="reserved-syntax">sibling</span><span class="plain-syntax">(</span><span class="identifier-syntax">memb</span><span class="plain-syntax">)) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="identifier-syntax">memb</span><span class="plain-syntax">, </span><span class="string-syntax">" --&gt; "</span><span class="plain-syntax">; </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
<span class="plain-syntax">#</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
</pre>
<p class="commentary firstcommentary"><a id="SP16" class="paragraph-anchor"></a><b>&#167;16. WriteListFrom.</b>And here we go at last. Or at any rate we initialise the quartet of global
variables detailing the current list-writing process, and begin.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">WriteListFrom</span><span class="plain-syntax"> </span><span class="identifier-syntax">first</span><span class="plain-syntax"> </span><span class="identifier-syntax">in_style</span><span class="plain-syntax"> </span><span class="identifier-syntax">depth</span><span class="plain-syntax"> </span><span class="identifier-syntax">noactivity</span><span class="plain-syntax"> </span><span class="identifier-syntax">iter</span><span class="plain-syntax"> </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">ol</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">c_iterator</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">c_style</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">c_depth</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">c_margin</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">iter</span><span class="plain-syntax">) </span><span class="identifier-syntax">c_iterator</span><span class="plain-syntax"> = </span><span class="identifier-syntax">iter</span><span class="plain-syntax">; </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">c_iterator</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ObjectTreeIterator</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> = </span><span class="identifier-syntax">in_style</span><span class="plain-syntax">; </span><span class="identifier-syntax">c_depth</span><span class="plain-syntax"> = </span><span class="identifier-syntax">depth</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">c_margin</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">in_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">EXTRAINDENT_BIT</span><span class="plain-syntax">) </span><span class="identifier-syntax">c_margin</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">objectloop</span><span class="plain-syntax"> (</span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="reserved-syntax">ofclass</span><span class="plain-syntax"> </span><span class="identifier-syntax">Object</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">give</span><span class="plain-syntax"> </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">list_filter_permits</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">list_filter_routine</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">list_filter_routine</span><span class="plain-syntax">(</span><span class="identifier-syntax">a</span><span class="plain-syntax">) == </span><span class="reserved-syntax">false</span><span class="plain-syntax">))</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">give</span><span class="plain-syntax"> </span><span class="identifier-syntax">a</span><span class="plain-syntax"> ~</span><span class="identifier-syntax">list_filter_permits</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">first</span><span class="plain-syntax"> = </span><span class="identifier-syntax">c_iterator</span><span class="plain-syntax">(</span><span class="identifier-syntax">first</span><span class="plain-syntax">, </span><span class="identifier-syntax">depth</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="identifier-syntax">START_ITF</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">first</span><span class="plain-syntax"> == </span><span class="reserved-syntax">nothing</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">in_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">ISARE_BIT</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'W'</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'Y'</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">in_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">NEWLINE_BIT</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">noactivity</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">iter</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WriteListR</span><span class="plain-syntax">(</span><span class="identifier-syntax">first</span><span class="plain-syntax">, </span><span class="identifier-syntax">c_depth</span><span class="plain-syntax">, </span><span class="reserved-syntax">true</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">say__p</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">objectloop</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ol</span><span class="plain-syntax"> </span><span class="reserved-syntax">provides</span><span class="plain-syntax"> </span><span class="identifier-syntax">list_together</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">CopyPV</span><span class="plain-syntax">(</span><span class="identifier-syntax">ol</span><span class="plain-syntax">.</span><span class="identifier-syntax">list_together</span><span class="plain-syntax">, </span><span class="identifier-syntax">EMPTY_TEXT_VALUE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">CarryOutActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">LISTING_CONTENTS_ACT</span><span class="plain-syntax">, </span><span class="reserved-syntax">parent</span><span class="plain-syntax">(</span><span class="identifier-syntax">first</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">c_margin</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">c_depth</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">c_style</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">c_iterator</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP17" class="paragraph-anchor"></a><b>&#167;17. Standard Contents Listing Rule.</b>The default for the listing contents activity is to call this rule in its
"for" stage: note that this suppresses the use of the activity, to avoid
an infinite regress. The activity is used only for the default
<span class="extract"><span class="extract-syntax">ObjectTreeIterator</span></span>, so there is no need to specify which is used.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">STANDARD_CONTENTS_LISTING_R</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WriteListFrom</span><span class="plain-syntax">(</span><span class="reserved-syntax">child</span><span class="plain-syntax">(</span><span class="identifier-syntax">parameter_value</span><span class="plain-syntax">), </span><span class="identifier-syntax">c_style</span><span class="plain-syntax">, </span><span class="identifier-syntax">c_depth</span><span class="plain-syntax">, </span><span class="reserved-syntax">true</span><span class="plain-syntax">);</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP18" class="paragraph-anchor"></a><b>&#167;18. Partitioning.</b>Given qualifying objects \(x_1, ..., x_j\), we partition them into classes of
the equivalence relation \(x_i\sim x_j\) if and only
</p>

<ul class="items"><li>(i) they both have a <span class="extract"><span class="extract-syntax">plural</span></span> property (not necessarily the same), and
</li><li>(ii) neither will cause the list-maker to recurse downwards to show the
objects inside or on top of them, and
</li><li>(iii) if they cause the list-maker to add information about whether they
are worn, lighted or open, then it will add the same information about both, and
</li><li>(iv) they are considered identical by the parser, in that they respond to the
same syntaxes of name: so that it is impossible to find a TAKE X command such
that X matches one and not the other.
</li></ul>
<p class="commentary">The equivalence classes are numbered consecutively upwards from 1 to \(n\),
in order of first appearance in the list. For each object \(x_i\),
<span class="extract"><span class="extract-syntax">partition_classes-&gt;(i-1)</span></span> is the number of its equivalence class. For each
equivalence class number \(c\), <span class="extract"><span class="extract-syntax">partition_class_sizes-&gt;c</span></span> is the number of
objects in this class.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">#</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">LKTRACE_LIST_WRITER</span><span class="plain-syntax">;</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">DBLW_no_classes</span><span class="plain-syntax">; </span><span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">DBLW_no_objs</span><span class="plain-syntax">;</span>
<span class="plain-syntax">[ </span><span class="identifier-syntax">DebugPartition</span><span class="plain-syntax"> </span><span class="identifier-syntax">partition_class_sizes</span><span class="plain-syntax"> </span><span class="identifier-syntax">partition_classes</span><span class="plain-syntax"> </span><span class="identifier-syntax">first</span><span class="plain-syntax"> </span><span class="identifier-syntax">depth</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">k</span><span class="plain-syntax"> </span><span class="identifier-syntax">o</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"[Length of list is "</span><span class="plain-syntax">, </span><span class="identifier-syntax">DBLW_no_objs</span><span class="plain-syntax">, </span><span class="string-syntax">" with "</span><span class="plain-syntax">, </span><span class="identifier-syntax">k</span><span class="plain-syntax">, </span><span class="string-syntax">" plural.]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"[Partitioned into "</span><span class="plain-syntax">, </span><span class="identifier-syntax">DBLW_no_classes</span><span class="plain-syntax">, </span><span class="string-syntax">" equivalence classes.]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=1: </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">DBLW_no_classes</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"Class "</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="string-syntax">" has size "</span><span class="plain-syntax">, </span><span class="identifier-syntax">partition_class_sizes</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="string-syntax">"^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">k</span><span class="plain-syntax">=0, </span><span class="identifier-syntax">o</span><span class="plain-syntax">=</span><span class="identifier-syntax">first</span><span class="plain-syntax">: </span><span class="identifier-syntax">k</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">DBLW_no_objs</span><span class="plain-syntax"> : </span><span class="identifier-syntax">k</span><span class="plain-syntax">++, </span><span class="identifier-syntax">o</span><span class="plain-syntax"> = </span><span class="identifier-syntax">c_iterator</span><span class="plain-syntax">(</span><span class="identifier-syntax">o</span><span class="plain-syntax">, </span><span class="identifier-syntax">depth</span><span class="plain-syntax">, </span><span class="identifier-syntax">lt_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">ADVANCE_ITF</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"Entry "</span><span class="plain-syntax">, </span><span class="identifier-syntax">k</span><span class="plain-syntax">, </span><span class="string-syntax">" has class "</span><span class="plain-syntax">, </span><span class="identifier-syntax">partition_classes</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">k</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">" represented by "</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">, </span><span class="string-syntax">" with L="</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">.</span><span class="identifier-syntax">list_together</span><span class="plain-syntax">, </span><span class="string-syntax">"^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">];</span>
<span class="plain-syntax">#</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
</pre>
<p class="commentary firstcommentary"><a id="SP19" class="paragraph-anchor"></a><b>&#167;19. Partition List.</b>The following creates the <span class="extract"><span class="extract-syntax">partition_classes</span></span> and <span class="extract"><span class="extract-syntax">partition_class_sizes</span></span>
accordingly. We return \(n\), the number of classes.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">PartitionList</span><span class="plain-syntax"> </span><span class="identifier-syntax">first</span><span class="plain-syntax"> </span><span class="identifier-syntax">no_objs</span><span class="plain-syntax"> </span><span class="identifier-syntax">depth</span><span class="plain-syntax"> </span><span class="identifier-syntax">partition_classes</span><span class="plain-syntax"> </span><span class="identifier-syntax">partition_class_sizes</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">k</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax"> </span><span class="identifier-syntax">n</span><span class="plain-syntax"> </span><span class="identifier-syntax">m</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0: </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">no_objs</span><span class="plain-syntax">: </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">partition_classes</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">n</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=</span><span class="identifier-syntax">first</span><span class="plain-syntax">, </span><span class="identifier-syntax">k</span><span class="plain-syntax">=0: </span><span class="identifier-syntax">k</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">no_objs</span><span class="plain-syntax">: </span><span class="identifier-syntax">i</span><span class="plain-syntax">=</span><span class="identifier-syntax">c_iterator</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">depth</span><span class="plain-syntax">, </span><span class="identifier-syntax">lt_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">ADVANCE_ITF</span><span class="plain-syntax">), </span><span class="identifier-syntax">k</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">partition_classes</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">k</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">partition_classes</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="identifier-syntax">n</span><span class="plain-syntax">; </span><span class="identifier-syntax">partition_class_sizes</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">n</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax">=</span><span class="identifier-syntax">c_iterator</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">depth</span><span class="plain-syntax">, </span><span class="identifier-syntax">lt_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">ADVANCE_ITF</span><span class="plain-syntax">), </span><span class="identifier-syntax">m</span><span class="plain-syntax">=</span><span class="identifier-syntax">k</span><span class="plain-syntax">+1:</span>
<span class="plain-syntax">                (</span><span class="identifier-syntax">l</span><span class="plain-syntax">~=0) &amp;&amp; (</span><span class="identifier-syntax">m</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">no_objs</span><span class="plain-syntax">):</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">l</span><span class="plain-syntax">=</span><span class="identifier-syntax">c_iterator</span><span class="plain-syntax">(</span><span class="identifier-syntax">l</span><span class="plain-syntax">, </span><span class="identifier-syntax">depth</span><span class="plain-syntax">, </span><span class="identifier-syntax">lt_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">ADVANCE_ITF</span><span class="plain-syntax">), </span><span class="identifier-syntax">m</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">partition_classes</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">m</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">ListEqual</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">l</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">partition_class_sizes</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">n</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">255</span><span class="plain-syntax">) (</span><span class="identifier-syntax">partition_class_sizes</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">n</span><span class="plain-syntax">)++;</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">partition_classes</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">m</span><span class="plain-syntax"> = </span><span class="identifier-syntax">n</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">n</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">255</span><span class="plain-syntax">) </span><span class="identifier-syntax">n</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">n</span><span class="plain-syntax">--;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">LKTRACE_LIST_WRITER</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">DBLW_no_classes</span><span class="plain-syntax"> = </span><span class="identifier-syntax">n</span><span class="plain-syntax">; </span><span class="identifier-syntax">DBLW_no_objs</span><span class="plain-syntax"> = </span><span class="identifier-syntax">no_objs</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">DebugPartition</span><span class="plain-syntax">(</span><span class="identifier-syntax">partition_class_sizes</span><span class="plain-syntax">, </span><span class="identifier-syntax">partition_classes</span><span class="plain-syntax">, </span><span class="identifier-syntax">first</span><span class="plain-syntax">, </span><span class="identifier-syntax">depth</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">n</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP20" class="paragraph-anchor"></a><b>&#167;20. Equivalence Relation.</b>The above algorithm will fail unless <span class="extract"><span class="extract-syntax">ListEqual</span></span> is indeed reflexive, symmetric
and transitive, which ultimately depends on the care with which <span class="extract"><span class="extract-syntax">Identical</span></span>
is implemented, which in turn hangs on the <span class="extract"><span class="extract-syntax">parse_noun</span></span> properties compiled
by Inform. But this seems to be sound.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">ListEqual</span><span class="plain-syntax"> </span><span class="identifier-syntax">o1</span><span class="plain-syntax"> </span><span class="identifier-syntax">o2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">  </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o1</span><span class="plain-syntax">.</span><span class="identifier-syntax">KD_Count</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">o2</span><span class="plain-syntax">.</span><span class="identifier-syntax">KD_Count</span><span class="plain-syntax">) </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">  </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">o1</span><span class="plain-syntax">.</span><span class="identifier-syntax">plural</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">o2</span><span class="plain-syntax">.</span><span class="identifier-syntax">plural</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">)) </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">  </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ObviouslyOccupied</span><span class="plain-syntax">(</span><span class="identifier-syntax">o1</span><span class="plain-syntax">) &amp;&amp; </span><span class="identifier-syntax">WillRecurs</span><span class="plain-syntax">(</span><span class="identifier-syntax">o1</span><span class="plain-syntax">)) </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">  </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ObviouslyOccupied</span><span class="plain-syntax">(</span><span class="identifier-syntax">o2</span><span class="plain-syntax">) &amp;&amp; </span><span class="identifier-syntax">WillRecurs</span><span class="plain-syntax">(</span><span class="identifier-syntax">o2</span><span class="plain-syntax">)) </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">  </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; (</span><span class="identifier-syntax">FULLINV_BIT</span><span class="plain-syntax"> + </span><span class="identifier-syntax">PARTINV_BIT</span><span class="plain-syntax">) ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">o1</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">worn</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">o2</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">worn</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">o2</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">worn</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">o1</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">worn</span><span class="plain-syntax">)) </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">o1</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">light</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">o2</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">light</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">o2</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">light</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">o1</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">light</span><span class="plain-syntax">)) </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">o1</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">open</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">o2</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">open</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">o2</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">open</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">o1</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">open</span><span class="plain-syntax">)) </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">  }</span>
<span class="plain-syntax">  </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">Identical</span><span class="plain-syntax">(</span><span class="identifier-syntax">o1</span><span class="plain-syntax">, </span><span class="identifier-syntax">o2</span><span class="plain-syntax">);</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">WillRecurs</span><span class="plain-syntax"> </span><span class="identifier-syntax">o</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">ALWAYS_BIT</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">RECURSE_BIT</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">supporter</span><span class="plain-syntax">) || ((</span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">container</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">open</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">transparent</span><span class="plain-syntax">))) </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP21" class="paragraph-anchor"></a><b>&#167;21. Grouping.</b>A "group" is a maximally-sized run of one or more adjacent partition
classes in the list whose first members have a common value of
<span class="extract"><span class="extract-syntax">list_together</span></span> which is a routine or string, and which is not equal to
<span class="extract"><span class="extract-syntax">lt_value</span></span>, the current grouping value. (As we see below, it's by setting
<span class="extract"><span class="extract-syntax">lt_value</span></span> that we restrict attention to a particular group: if we reacted
to that as a <span class="extract"><span class="extract-syntax">list_together</span></span> value here, then we would simply go around in
circles, and never be able to see the individual objects in the group.)
</p>

<p class="commentary">For instance, suppose we have objects with <span class="extract"><span class="extract-syntax">list_together</span></span> values as follows,
where \(R_1\) and \(R_2\) are addresses of routines:
</p>

<p class="commentary"><span class="extract"><span class="extract-syntax">coin</span></span> (\(R_1\)), <span class="extract"><span class="extract-syntax">coin</span></span> (\(R_1\)), <span class="extract"><span class="extract-syntax">box</span></span> (\(R_2\)), <span class="extract"><span class="extract-syntax">statuette</span></span> (0), <span class="extract"><span class="extract-syntax">coin</span></span> (\(R_1\)), <span class="extract"><span class="extract-syntax">box</span></span> (\(R_2\))
</p>

<p class="commentary">Then the partition is 1, 1, 2, 3, 1, 2, so that the final output will be
something like "three coins, two boxes and a statuette" &mdash; with three
grouped terms. Here each partition class is the only member in its group,
so the number of groups is the same as the number of classes. (The above
list is not coalesced, so the \(R_1\) values, for instance, are not
contiguous: we need to work in general with non-coalesced lists because
not every iterator function will be able to coalesce fully.)
</p>

<p class="commentary">But if we have something like this:
</p>

<p class="commentary"><span class="extract"><span class="extract-syntax">coin</span></span> (\(R_1\)), <span class="extract"><span class="extract-syntax">Q</span></span> (\(R_2\)), <span class="extract"><span class="extract-syntax">W</span></span> (\(R_2\)), <span class="extract"><span class="extract-syntax">coin</span></span> (\(R_1\)), <span class="extract"><span class="extract-syntax">statuette</span></span> (0), <span class="extract"><span class="extract-syntax">E</span></span> (\(R_2\)), <span class="extract"><span class="extract-syntax">R</span></span> (\(R_2\))
</p>

<p class="commentary">then the partition is 1, 2, 3, 1, 4, 5, 6 and we have six classes in all.
But classes 2 and 3 are grouped together, as are classes 5 and 6, so we
end up with a list having just four groups: "two coins, the letters Q and
W from a Scrabble set, a statuette and the letters E and R from a Scrabble
set". (Again, this list has not been fully coalesced: if it had been, it
would be reordered <span class="extract"><span class="extract-syntax">coin</span></span>, <span class="extract"><span class="extract-syntax">coin</span></span>, <span class="extract"><span class="extract-syntax">Q</span></span>, <span class="extract"><span class="extract-syntax">W</span></span>, <span class="extract"><span class="extract-syntax">E</span></span>, <span class="extract"><span class="extract-syntax">R</span></span>, <span class="extract"><span class="extract-syntax">statuette</span></span>, with
partition 1, 1, 2, 3, 4, 5, 6, and three groups: "two coins, the letters Q,
W, E and R from a Scrabble set and a statuette".)
</p>

<p class="commentary">The reason we do not group together classes with a common non-zero
<span class="extract"><span class="extract-syntax">list_together</span></span> which is {\it not} a routine or string is that low values
of <span class="extract"><span class="extract-syntax">list_together</span></span> are used in coalescing the list into a pleasing order
(say, moving all of the key-like items together) but not in grouping: see
<span class="extract"><span class="extract-syntax">list_together</span></span> in the {\it Inform Designer's Manual}, 4th edition.
</p>

<p class="commentary">We calculate the number of groups by starting with the number of classes
and then subtracting one each time two adjacent classes share <span class="extract"><span class="extract-syntax">list_together</span></span>
in the above sense.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">NumberOfGroupsInList</span><span class="plain-syntax"> </span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="identifier-syntax">no_classes</span><span class="plain-syntax"> </span><span class="identifier-syntax">depth</span><span class="plain-syntax"> </span><span class="identifier-syntax">partition_classes</span><span class="plain-syntax"> </span><span class="identifier-syntax">partition_class_sizes</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">no_groups</span><span class="plain-syntax"> </span><span class="identifier-syntax">cl</span><span class="plain-syntax"> </span><span class="identifier-syntax">memb</span><span class="plain-syntax"> </span><span class="identifier-syntax">k</span><span class="plain-syntax"> </span><span class="identifier-syntax">current_lt</span><span class="plain-syntax"> </span><span class="identifier-syntax">lt</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">current_lt</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EMPTY_TEXT_VALUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">lt</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EMPTY_TEXT_VALUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">no_groups</span><span class="plain-syntax"> = </span><span class="identifier-syntax">no_classes</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cl</span><span class="plain-syntax">=1, </span><span class="identifier-syntax">memb</span><span class="plain-syntax">=</span><span class="identifier-syntax">o</span><span class="plain-syntax">, </span><span class="identifier-syntax">k</span><span class="plain-syntax">=0: </span><span class="identifier-syntax">cl</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">no_classes</span><span class="plain-syntax">: </span><span class="identifier-syntax">cl</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="comment-syntax">Advance to first member of class number cl</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="identifier-syntax">partition_classes</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">k</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">cl</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">k</span><span class="plain-syntax">++; </span><span class="identifier-syntax">memb</span><span class="plain-syntax"> = </span><span class="identifier-syntax">c_iterator</span><span class="plain-syntax">(</span><span class="identifier-syntax">memb</span><span class="plain-syntax">, </span><span class="identifier-syntax">depth</span><span class="plain-syntax">, </span><span class="identifier-syntax">lt_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">ADVANCE_ITF</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">memb</span><span class="plain-syntax">) { </span><span class="comment-syntax">In case of accidents, but should always happen</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">lt</span><span class="plain-syntax"> = </span><span class="identifier-syntax">memb</span><span class="plain-syntax">.</span><span class="identifier-syntax">list_together</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">LT_Compare</span><span class="plain-syntax">(</span><span class="identifier-syntax">lt</span><span class="plain-syntax">, </span><span class="identifier-syntax">lt_value</span><span class="plain-syntax">) ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">                (</span><span class="identifier-syntax">LT_Compare</span><span class="plain-syntax">(</span><span class="identifier-syntax">lt</span><span class="plain-syntax">, </span><span class="identifier-syntax">EMPTY_TEXT_VALUE</span><span class="plain-syntax">) ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">                (</span><span class="identifier-syntax">LT_Compare</span><span class="plain-syntax">(</span><span class="identifier-syntax">lt</span><span class="plain-syntax">, </span><span class="identifier-syntax">current_lt</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">no_groups</span><span class="plain-syntax">--;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">current_lt</span><span class="plain-syntax"> = </span><span class="identifier-syntax">lt</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">LKTRACE_LIST_WRITER</span><span class="plain-syntax">; </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"[There are "</span><span class="plain-syntax">, </span><span class="identifier-syntax">no_groups</span><span class="plain-syntax">, </span><span class="string-syntax">" groups.]^"</span><span class="plain-syntax">; #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">no_groups</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">LT_Compare</span><span class="plain-syntax"> </span><span class="identifier-syntax">lt1</span><span class="plain-syntax"> </span><span class="identifier-syntax">lt2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">lt1</span><span class="plain-syntax"> == </span><span class="identifier-syntax">lt2</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">lt1</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">lt1</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EMPTY_TEXT_VALUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">lt2</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">lt2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EMPTY_TEXT_VALUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">TEXT_TY_IsSubstituted</span><span class="plain-syntax">(</span><span class="identifier-syntax">lt1</span><span class="plain-syntax">) == </span><span class="reserved-syntax">false</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">TEXT_TY_IsSubstituted</span><span class="plain-syntax">(</span><span class="identifier-syntax">lt2</span><span class="plain-syntax">) == </span><span class="reserved-syntax">false</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="identifier-syntax">lt1</span><span class="plain-syntax">--&gt;1)-(</span><span class="identifier-syntax">lt2</span><span class="plain-syntax">--&gt;1);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> -1;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">TEXT_TY_IsSubstituted</span><span class="plain-syntax">(</span><span class="identifier-syntax">lt2</span><span class="plain-syntax">) == </span><span class="reserved-syntax">false</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> -1;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">ComparePV</span><span class="plain-syntax">(</span><span class="identifier-syntax">lt1</span><span class="plain-syntax">, </span><span class="identifier-syntax">lt2</span><span class="plain-syntax">);</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP22" class="paragraph-anchor"></a><b>&#167;22. Write List Recursively.</b>The big one: <span class="extract"><span class="extract-syntax">WriteListR</span></span> is the heart of the list-writer.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">WriteListR</span><span class="plain-syntax"> </span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="identifier-syntax">depth</span><span class="plain-syntax"> </span><span class="identifier-syntax">from_start</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">partition_classes</span><span class="plain-syntax"> </span><span class="identifier-syntax">partition_class_sizes</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">cl</span><span class="plain-syntax"> </span><span class="identifier-syntax">memb</span><span class="plain-syntax"> </span><span class="identifier-syntax">index</span><span class="plain-syntax"> </span><span class="identifier-syntax">k2</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax"> </span><span class="identifier-syntax">m</span><span class="plain-syntax"> </span><span class="identifier-syntax">no_classes</span><span class="plain-syntax"> </span><span class="identifier-syntax">q</span><span class="plain-syntax"> </span><span class="identifier-syntax">groups_to_do</span><span class="plain-syntax"> </span><span class="identifier-syntax">current_lt</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> == </span><span class="reserved-syntax">nothing</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">; </span><span class="comment-syntax">An empty list: no output</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">from_start</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">o</span><span class="plain-syntax"> = </span><span class="identifier-syntax">c_iterator</span><span class="plain-syntax">(</span><span class="identifier-syntax">o</span><span class="plain-syntax">, </span><span class="identifier-syntax">depth</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="identifier-syntax">COALESCE_ITF</span><span class="plain-syntax">); </span><span class="comment-syntax">Coalesce list and choose new start</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">o</span><span class="plain-syntax"> = </span><span class="identifier-syntax">c_iterator</span><span class="plain-syntax">(</span><span class="identifier-syntax">o</span><span class="plain-syntax">, </span><span class="identifier-syntax">depth</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="identifier-syntax">SEEK_ITF</span><span class="plain-syntax">); </span><span class="comment-syntax">Find first entry in list from o</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> == </span><span class="reserved-syntax">nothing</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="comment-syntax">Count index = length of list</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">memb</span><span class="plain-syntax">=</span><span class="identifier-syntax">o</span><span class="plain-syntax">, </span><span class="identifier-syntax">index</span><span class="plain-syntax">=0: </span><span class="identifier-syntax">memb</span><span class="plain-syntax">: </span><span class="identifier-syntax">memb</span><span class="plain-syntax">=</span><span class="identifier-syntax">c_iterator</span><span class="plain-syntax">(</span><span class="identifier-syntax">memb</span><span class="plain-syntax">, </span><span class="identifier-syntax">depth</span><span class="plain-syntax">, </span><span class="identifier-syntax">lt_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">ADVANCE_ITF</span><span class="plain-syntax">)) </span><span class="identifier-syntax">index</span><span class="plain-syntax">++;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">ISARE_BIT</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">SetLWI</span><span class="plain-syntax">(</span><span class="identifier-syntax">index</span><span class="plain-syntax">, -1, </span><span class="identifier-syntax">o</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'V'</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">NEWLINE_BIT</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">)   </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">":^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax">                              </span><span class="reserved-syntax">print</span><span class="plain-syntax"> (</span><span class="identifier-syntax">char</span><span class="plain-syntax">) </span><span class="character-syntax">' '</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> = </span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> - </span><span class="identifier-syntax">ISARE_BIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">partition_classes</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RequisitionStack</span><span class="plain-syntax">(</span><span class="identifier-syntax">index</span><span class="plain-syntax">/</span><span class="identifier-syntax">WORDSIZE</span><span class="plain-syntax"> + </span><span class="constant-syntax">2</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">partition_class_sizes</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RequisitionStack</span><span class="plain-syntax">(</span><span class="identifier-syntax">index</span><span class="plain-syntax">/</span><span class="identifier-syntax">WORDSIZE</span><span class="plain-syntax"> + </span><span class="constant-syntax">2</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">partition_classes</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">partition_class_sizes</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">IssueRTP</span><span class="plain-syntax">(</span><span class="string-syntax">"ListWriterRanOutOfMemory"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"The list-writer has run out of memory.^"</span><span class="plain-syntax">, </span><span class="identifier-syntax">BasicInformKitRTPs</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">no_classes</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">PartitionList</span><span class="plain-syntax">(</span><span class="identifier-syntax">o</span><span class="plain-syntax">, </span><span class="identifier-syntax">index</span><span class="plain-syntax">, </span><span class="identifier-syntax">depth</span><span class="plain-syntax">, </span><span class="identifier-syntax">partition_classes</span><span class="plain-syntax">, </span><span class="identifier-syntax">partition_class_sizes</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">groups_to_do</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">NumberOfGroupsInList</span><span class="plain-syntax">(</span><span class="identifier-syntax">o</span><span class="plain-syntax">, </span><span class="identifier-syntax">no_classes</span><span class="plain-syntax">, </span><span class="identifier-syntax">depth</span><span class="plain-syntax">, </span><span class="identifier-syntax">partition_classes</span><span class="plain-syntax">, </span><span class="identifier-syntax">partition_class_sizes</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cl</span><span class="plain-syntax">=1, </span><span class="identifier-syntax">memb</span><span class="plain-syntax">=</span><span class="identifier-syntax">o</span><span class="plain-syntax">, </span><span class="identifier-syntax">index</span><span class="plain-syntax">=0, </span><span class="identifier-syntax">current_lt</span><span class="plain-syntax">=</span><span class="identifier-syntax">EMPTY_TEXT_VALUE</span><span class="plain-syntax">: </span><span class="identifier-syntax">groups_to_do</span><span class="plain-syntax">&gt;0: </span><span class="identifier-syntax">cl</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="comment-syntax">Set memb to first object of partition class cl</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="identifier-syntax">partition_classes</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">index</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">cl</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">index</span><span class="plain-syntax">++; </span><span class="identifier-syntax">memb</span><span class="plain-syntax">=</span><span class="identifier-syntax">c_iterator</span><span class="plain-syntax">(</span><span class="identifier-syntax">memb</span><span class="plain-syntax">, </span><span class="identifier-syntax">depth</span><span class="plain-syntax">, </span><span class="identifier-syntax">lt_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">ADVANCE_ITF</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">memb</span><span class="plain-syntax">==0) { </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"*** Error in list-writer ***^"</span><span class="plain-syntax">; </span><span class="reserved-syntax">return</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        }</span>

<span class="plain-syntax">        #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">LKTRACE_LIST_WRITER</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="comment-syntax">DebugPartition(partition_class_sizes, partition_classes, o, depth);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"^[Class "</span><span class="plain-syntax">, </span><span class="identifier-syntax">cl</span><span class="plain-syntax">, </span><span class="string-syntax">" of "</span><span class="plain-syntax">, </span><span class="identifier-syntax">no_classes</span><span class="plain-syntax">, </span><span class="string-syntax">": first object "</span><span class="plain-syntax">, </span><span class="identifier-syntax">memb</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">" ("</span><span class="plain-syntax">, </span><span class="identifier-syntax">memb</span><span class="plain-syntax">.</span><span class="identifier-syntax">list_together</span><span class="plain-syntax">, </span><span class="string-syntax">"); groups_to_do "</span><span class="plain-syntax">, </span><span class="identifier-syntax">groups_to_do</span><span class="plain-syntax">, </span><span class="string-syntax">",</span>
<span class="string-syntax">            current_lt="</span><span class="plain-syntax">, </span><span class="identifier-syntax">current_lt</span><span class="plain-syntax">, </span><span class="string-syntax">" listing_size="</span><span class="plain-syntax">, </span><span class="identifier-syntax">listing_size</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">" lt_value="</span><span class="plain-syntax">, </span><span class="identifier-syntax">lt_value</span><span class="plain-syntax">, </span><span class="string-syntax">" memb.list_together="</span><span class="plain-syntax">, </span><span class="identifier-syntax">memb</span><span class="plain-syntax">.</span><span class="identifier-syntax">list_together</span><span class="plain-syntax">, </span><span class="string-syntax">"]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">LT_Compare</span><span class="plain-syntax">(</span><span class="identifier-syntax">memb</span><span class="plain-syntax">.</span><span class="identifier-syntax">list_together</span><span class="plain-syntax">, </span><span class="identifier-syntax">lt_value</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">LT_Compare</span><span class="plain-syntax">(</span><span class="identifier-syntax">memb</span><span class="plain-syntax">.</span><span class="identifier-syntax">list_together</span><span class="plain-syntax">, </span><span class="identifier-syntax">EMPTY_TEXT_VALUE</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">)) </span><span class="identifier-syntax">current_lt</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EMPTY_TEXT_VALUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">LT_Compare</span><span class="plain-syntax">(</span><span class="identifier-syntax">memb</span><span class="plain-syntax">.</span><span class="identifier-syntax">list_together</span><span class="plain-syntax">, </span><span class="identifier-syntax">current_lt</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>

<span class="plain-syntax">            </span><span class="comment-syntax">Otherwise this class begins a new group</span>
<span class="plain-syntax">            @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">listing_size</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">q</span><span class="plain-syntax"> = </span><span class="identifier-syntax">memb</span><span class="plain-syntax">; </span><span class="identifier-syntax">listing_size</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">; </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">index</span><span class="plain-syntax">; </span><span class="identifier-syntax">m</span><span class="plain-syntax"> = </span><span class="identifier-syntax">cl</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="identifier-syntax">m</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">no_classes</span><span class="plain-syntax"> &amp;&amp;</span>
<span class="plain-syntax">                (</span><span class="identifier-syntax">LT_Compare</span><span class="plain-syntax">(</span><span class="identifier-syntax">q</span><span class="plain-syntax">.</span><span class="identifier-syntax">list_together</span><span class="plain-syntax">, </span><span class="identifier-syntax">memb</span><span class="plain-syntax">.</span><span class="identifier-syntax">list_together</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">m</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="identifier-syntax">partition_classes</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">l</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">m</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">l</span><span class="plain-syntax">++; </span><span class="identifier-syntax">q</span><span class="plain-syntax"> = </span><span class="identifier-syntax">c_iterator</span><span class="plain-syntax">(</span><span class="identifier-syntax">q</span><span class="plain-syntax">, </span><span class="identifier-syntax">depth</span><span class="plain-syntax">, </span><span class="identifier-syntax">lt_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">ADVANCE_ITF</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">LT_Compare</span><span class="plain-syntax">(</span><span class="identifier-syntax">q</span><span class="plain-syntax">.</span><span class="identifier-syntax">list_together</span><span class="plain-syntax">, </span><span class="identifier-syntax">memb</span><span class="plain-syntax">.</span><span class="identifier-syntax">list_together</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">listing_size</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">            }</span>

<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">listing_size</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">1</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="comment-syntax">The new group contains more than one partition class</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">WriteMultiClassGroup</span><span class="plain-syntax">(</span><span class="identifier-syntax">cl</span><span class="plain-syntax">, </span><span class="identifier-syntax">memb</span><span class="plain-syntax">, </span><span class="identifier-syntax">depth</span><span class="plain-syntax">, </span><span class="identifier-syntax">partition_class_sizes</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">current_lt</span><span class="plain-syntax"> = </span><span class="identifier-syntax">memb</span><span class="plain-syntax">.</span><span class="identifier-syntax">list_together</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">GroupComplete</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">current_lt</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EMPTY_TEXT_VALUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">listing_size</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>

<span class="plain-syntax">        </span><span class="identifier-syntax">WriteSingleClassGroup</span><span class="plain-syntax">(</span><span class="identifier-syntax">cl</span><span class="plain-syntax">, </span><span class="identifier-syntax">memb</span><span class="plain-syntax">, </span><span class="identifier-syntax">depth</span><span class="plain-syntax">, </span><span class="identifier-syntax">partition_class_sizes</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">cl</span><span class="plain-syntax">);</span>

<span class="plain-syntax">        .</span><span class="identifier-syntax">GroupComplete</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">groups_to_do</span><span class="plain-syntax">--;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">ENGLISH_BIT</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">groups_to_do</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">BasicInformKit</span><span class="plain-syntax">`</span><span class="identifier-syntax">SERIAL_COMMA_CFGF</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cl</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">1</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">","</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'C'</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">groups_to_do</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">1</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">", "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">FreeStack</span><span class="plain-syntax">(</span><span class="identifier-syntax">partition_class_sizes</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">FreeStack</span><span class="plain-syntax">(</span><span class="identifier-syntax">partition_classes</span><span class="plain-syntax">);</span>
<span class="plain-syntax">]; </span><span class="comment-syntax">end of WriteListR</span>
</pre>
<p class="commentary firstcommentary"><a id="SP23" class="paragraph-anchor"></a><b>&#167;23. Write Multiple Class Group.</b>The text of a single group which contains more than one partition class.
We carry out the "grouping together" activity, so that the user can add
text fore and aft &mdash; this is how groups of objects such as "X, Y and Z"
can be fluffed up to "the letters X, Y and Z from a Scrabble set" &mdash;
but the default is simple: we print the grouped items by calling
<span class="extract"><span class="extract-syntax">WriteListR</span></span> once again, but this time starting from X, and where
<span class="extract"><span class="extract-syntax">lt_value</span></span> is set to the common <span class="extract"><span class="extract-syntax">list_together</span></span> value of X, Y and Z.
(That restricts the list to just the objects in this group.) Because
<span class="extract"><span class="extract-syntax">lt_value</span></span> is set to this value, the grouping code won't then group X, Y
and Z again, and they will instead be individual classes in the new
list &mdash; so each will end up being sent, in turn, to <span class="extract"><span class="extract-syntax">WriteSingleClassGroup</span></span>
below, and {\it that} is where they are printed.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">WriteMultiClassGroup</span><span class="plain-syntax"> </span><span class="identifier-syntax">cl</span><span class="plain-syntax"> </span><span class="identifier-syntax">memb</span><span class="plain-syntax"> </span><span class="identifier-syntax">depth</span><span class="plain-syntax"> </span><span class="identifier-syntax">partition_class_sizes</span><span class="plain-syntax"> </span><span class="identifier-syntax">pv</span><span class="plain-syntax"> </span><span class="identifier-syntax">q</span><span class="plain-syntax"> </span><span class="identifier-syntax">k2</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="comment-syntax">Save the style, because the activity below is allowed to change it</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">q</span><span class="plain-syntax"> = </span><span class="identifier-syntax">c_style</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">INDENT_BIT</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">PrintSpaces</span><span class="plain-syntax">(2*(</span><span class="identifier-syntax">depth</span><span class="plain-syntax">+</span><span class="identifier-syntax">c_margin</span><span class="plain-syntax">));</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">BeginActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">GROUPING_TOGETHER_ACT</span><span class="plain-syntax">, </span><span class="identifier-syntax">memb</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ForActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">GROUPING_TOGETHER_ACT</span><span class="plain-syntax">, </span><span class="identifier-syntax">memb</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> = </span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp;~ </span><span class="identifier-syntax">NEWLINE_BIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">pv</span><span class="plain-syntax"> = </span><span class="identifier-syntax">memb</span><span class="plain-syntax">.</span><span class="identifier-syntax">list_together</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">TEXT_TY_IsSubstituted</span><span class="plain-syntax">(</span><span class="identifier-syntax">pv</span><span class="plain-syntax">) == </span><span class="reserved-syntax">false</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">inventory_stage</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">parser_one</span><span class="plain-syntax"> = </span><span class="identifier-syntax">memb</span><span class="plain-syntax">; </span><span class="identifier-syntax">parser_two</span><span class="plain-syntax"> = </span><span class="identifier-syntax">depth</span><span class="plain-syntax"> + </span><span class="identifier-syntax">c_margin</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">pv</span><span class="plain-syntax">--&gt;1)() == </span><span class="constant-syntax">1</span><span class="plain-syntax">) </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">Omit__Sublist2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pv</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="comment-syntax">Set k2 to the number of objects covered by the group</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">k2</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">l</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">listing_size</span><span class="plain-syntax"> : </span><span class="identifier-syntax">l</span><span class="plain-syntax">++) </span><span class="identifier-syntax">k2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">k2</span><span class="plain-syntax"> + </span><span class="identifier-syntax">partition_class_sizes</span><span class="plain-syntax">-&gt;(</span><span class="identifier-syntax">l</span><span class="plain-syntax">+</span><span class="identifier-syntax">cl</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">EnglishNumber</span><span class="plain-syntax">(</span><span class="identifier-syntax">k2</span><span class="plain-syntax">); </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">" "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">print</span><span class="plain-syntax"> (</span><span class="identifier-syntax">TEXT_TY_Say</span><span class="plain-syntax">) </span><span class="identifier-syntax">pv</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">ENGLISH_BIT</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">" ("</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">INDENT_BIT</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">)  </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">":^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>

<span class="plain-syntax">        </span><span class="identifier-syntax">c_margin</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">        @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">lt_value</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">listing_together</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">listing_size</span><span class="plain-syntax">;</span>

<span class="plain-syntax">        </span><span class="identifier-syntax">lt_value</span><span class="plain-syntax"> = </span><span class="identifier-syntax">memb</span><span class="plain-syntax">.</span><span class="identifier-syntax">list_together</span><span class="plain-syntax">; </span><span class="identifier-syntax">listing_together</span><span class="plain-syntax"> = </span><span class="identifier-syntax">memb</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">LKTRACE_LIST_WRITER</span><span class="plain-syntax">; </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"^^DOWN lt_value = "</span><span class="plain-syntax">, </span><span class="identifier-syntax">lt_value</span><span class="plain-syntax">, </span><span class="string-syntax">" listing_together = "</span><span class="plain-syntax">, </span><span class="identifier-syntax">memb</span><span class="plain-syntax">, </span><span class="string-syntax">"^^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">DBLW_no_classes</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">DBLW_no_objs</span><span class="plain-syntax">; #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WriteListR</span><span class="plain-syntax">(</span><span class="identifier-syntax">memb</span><span class="plain-syntax">, </span><span class="identifier-syntax">depth</span><span class="plain-syntax">, </span><span class="reserved-syntax">false</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">LKTRACE_LIST_WRITER</span><span class="plain-syntax">; </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"^^UP^^"</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">DBLW_no_objs</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">DBLW_no_classes</span><span class="plain-syntax">; #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>

<span class="plain-syntax">        @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">listing_size</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">listing_together</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">lt_value</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">c_margin</span><span class="plain-syntax">--;</span>

<span class="plain-syntax">        </span><span class="identifier-syntax">pv</span><span class="plain-syntax"> = </span><span class="identifier-syntax">memb</span><span class="plain-syntax">.</span><span class="identifier-syntax">list_together</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">TEXT_TY_IsSubstituted</span><span class="plain-syntax">(</span><span class="identifier-syntax">pv</span><span class="plain-syntax">) == </span><span class="reserved-syntax">false</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">inventory_stage</span><span class="plain-syntax"> = </span><span class="constant-syntax">2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">parser_one</span><span class="plain-syntax"> = </span><span class="identifier-syntax">memb</span><span class="plain-syntax">; </span><span class="identifier-syntax">parser_two</span><span class="plain-syntax"> = </span><span class="identifier-syntax">depth</span><span class="plain-syntax">+</span><span class="identifier-syntax">c_margin</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">pv</span><span class="plain-syntax">--&gt;1)();</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">LT_Compare</span><span class="plain-syntax">(</span><span class="identifier-syntax">pv</span><span class="plain-syntax">, </span><span class="identifier-syntax">EMPTY_TEXT_VALUE</span><span class="plain-syntax">) ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">q</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">ENGLISH_BIT</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">")"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        .</span><span class="identifier-syntax">Omit__Sublist2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">EndActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">GROUPING_TOGETHER_ACT</span><span class="plain-syntax">, </span><span class="identifier-syntax">memb</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="comment-syntax">If the NEWLINE_BIT has been forced by the activity, act now</span>
<span class="plain-syntax">    </span><span class="comment-syntax">before it vanishes...</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">q</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">NEWLINE_BIT</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">NEWLINE_BIT</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="comment-syntax">...when the original style is restored again:</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> = </span><span class="identifier-syntax">q</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP24" class="paragraph-anchor"></a><b>&#167;24. Write Single Class Group.</b>The text of a single group which contains exactly one partition class.
Because of the way the multiple-class case recurses, every class ends up
in this routine sooner or later; this is the place where the actual
name of an object is printed, at long last.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">WriteSingleClassGroup</span><span class="plain-syntax"> </span><span class="identifier-syntax">cl</span><span class="plain-syntax"> </span><span class="identifier-syntax">memb</span><span class="plain-syntax"> </span><span class="identifier-syntax">depth</span><span class="plain-syntax"> </span><span class="identifier-syntax">size</span><span class="plain-syntax"> </span><span class="identifier-syntax">q</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">q</span><span class="plain-syntax"> = </span><span class="identifier-syntax">c_style</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">INDENT_BIT</span><span class="plain-syntax">) </span><span class="identifier-syntax">PrintSpaces</span><span class="plain-syntax">(2*(</span><span class="identifier-syntax">depth</span><span class="plain-syntax">+</span><span class="identifier-syntax">c_margin</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">size</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">NOARTICLE_BIT</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> (</span><span class="identifier-syntax">name</span><span class="plain-syntax">) </span><span class="identifier-syntax">memb</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">DEFART_BIT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">cl</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">CFIRSTART_BIT</span><span class="plain-syntax">)) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> (</span><span class="identifier-syntax">The</span><span class="plain-syntax">) </span><span class="identifier-syntax">memb</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">print</span><span class="plain-syntax"> (</span><span class="identifier-syntax">the</span><span class="plain-syntax">) </span><span class="identifier-syntax">memb</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">cl</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">CFIRSTART_BIT</span><span class="plain-syntax">)) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> (</span><span class="identifier-syntax">CIndefArt</span><span class="plain-syntax">) </span><span class="identifier-syntax">memb</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">print</span><span class="plain-syntax"> (</span><span class="identifier-syntax">a</span><span class="plain-syntax">) </span><span class="identifier-syntax">memb</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">DEFART_BIT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">cl</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">CFIRSTART_BIT</span><span class="plain-syntax">)) </span><span class="identifier-syntax">PrefaceByArticle</span><span class="plain-syntax">(</span><span class="identifier-syntax">memb</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="identifier-syntax">size</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">PrefaceByArticle</span><span class="plain-syntax">(</span><span class="identifier-syntax">memb</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">, </span><span class="identifier-syntax">size</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">listing_size</span><span class="plain-syntax">; </span><span class="identifier-syntax">listing_size</span><span class="plain-syntax"> = </span><span class="identifier-syntax">size</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">CarryOutActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">PRINTING_A_NUMBER_OF_ACT</span><span class="plain-syntax">, </span><span class="identifier-syntax">memb</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">listing_size</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">size</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">1</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">memb</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">pluralname</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">give</span><span class="plain-syntax"> </span><span class="identifier-syntax">memb</span><span class="plain-syntax"> </span><span class="identifier-syntax">pluralname</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WriteAfterEntry</span><span class="plain-syntax">(</span><span class="identifier-syntax">memb</span><span class="plain-syntax">, </span><span class="identifier-syntax">depth</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">give</span><span class="plain-syntax"> </span><span class="identifier-syntax">memb</span><span class="plain-syntax"> ~</span><span class="identifier-syntax">pluralname</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">WriteAfterEntry</span><span class="plain-syntax">(</span><span class="identifier-syntax">memb</span><span class="plain-syntax">, </span><span class="identifier-syntax">depth</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> = </span><span class="identifier-syntax">q</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP25" class="paragraph-anchor"></a><b>&#167;25. Write After Entry.</b>Each entry can be followed by supplementary, usually parenthetical, information:
exactly what, depends on the style. The extreme case is when the style, and
the object, call for recursion to list the object-tree contents: this is
achieved by calling <span class="extract"><span class="extract-syntax">WriteListR</span></span>, using the <span class="extract"><span class="extract-syntax">ObjectTreeIterator</span></span> (whatever
the iterator used at the top level) and increasing the depth by 1.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">WriteAfterEntry</span><span class="plain-syntax"> </span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="identifier-syntax">depth</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">p</span><span class="plain-syntax"> </span><span class="identifier-syntax">recurse_flag</span><span class="plain-syntax"> </span><span class="identifier-syntax">parenth_flag</span><span class="plain-syntax"> </span><span class="identifier-syntax">eldest_child</span><span class="plain-syntax"> </span><span class="identifier-syntax">child_count</span><span class="plain-syntax"> </span><span class="identifier-syntax">combo</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">inventory_stage</span><span class="plain-syntax"> = </span><span class="constant-syntax">2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">PARTINV_BIT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">BeginActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">PRINTING_ROOM_DESC_DETAILS_ACT</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ForActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">PRINTING_ROOM_DESC_DETAILS_ACT</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">) == </span><span class="reserved-syntax">false</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">combo</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">light</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">location</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">light</span><span class="plain-syntax">) </span><span class="identifier-syntax">combo</span><span class="plain-syntax">=</span><span class="identifier-syntax">combo</span><span class="plain-syntax">+1;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">container</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">open</span><span class="plain-syntax">)     </span><span class="identifier-syntax">combo</span><span class="plain-syntax">=</span><span class="identifier-syntax">combo</span><span class="plain-syntax">+2;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">container</span><span class="plain-syntax"> &amp;&amp; (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">open</span><span class="plain-syntax"> || </span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">transparent</span><span class="plain-syntax">))</span>
<span class="plain-syntax">                &amp;&amp; (</span><span class="reserved-syntax">child</span><span class="plain-syntax">(</span><span class="identifier-syntax">o</span><span class="plain-syntax">)==0))                    </span><span class="identifier-syntax">combo</span><span class="plain-syntax">=</span><span class="identifier-syntax">combo</span><span class="plain-syntax">+4;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">combo</span><span class="plain-syntax">) </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'A'</span><span class="plain-syntax">); </span><span class="comment-syntax">space and open bracket</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">combo</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="constant-syntax">1</span><span class="plain-syntax">: </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'D'</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="constant-syntax">2</span><span class="plain-syntax">: </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'E'</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="constant-syntax">3</span><span class="plain-syntax">: </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'H'</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="constant-syntax">4</span><span class="plain-syntax">: </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'F'</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="constant-syntax">5</span><span class="plain-syntax">: </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'I'</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="constant-syntax">6</span><span class="plain-syntax">: </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'G'</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="constant-syntax">7</span><span class="plain-syntax">: </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'J'</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">combo</span><span class="plain-syntax">) </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'B'</span><span class="plain-syntax">); </span><span class="comment-syntax">close bracket</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">EndActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">PRINTING_ROOM_DESC_DETAILS_ACT</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }   </span><span class="comment-syntax">end of PARTINV_BIT processing</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">FULLINV_BIT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">BeginActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">PRINTING_INVENTORY_DETAILS_ACT</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ForActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">PRINTING_INVENTORY_DETAILS_ACT</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">) == </span><span class="reserved-syntax">false</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">light</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">worn</span><span class="plain-syntax">) { </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'A'</span><span class="plain-syntax">); </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'K'</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">);  </span><span class="identifier-syntax">parenth_flag</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">light</span><span class="plain-syntax">)           { </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'A'</span><span class="plain-syntax">); </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'D'</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">);  </span><span class="identifier-syntax">parenth_flag</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">worn</span><span class="plain-syntax">)            { </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'A'</span><span class="plain-syntax">); </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'L'</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">); </span><span class="identifier-syntax">parenth_flag</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">            }</span>

<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">container</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">openable</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parenth_flag</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">BasicInformKit</span><span class="plain-syntax">`</span><span class="identifier-syntax">SERIAL_COMMA_CFGF</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                            </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">","</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                        </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'C'</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    } </span><span class="reserved-syntax">else</span><span class="plain-syntax">            </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'A'</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">open</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="reserved-syntax">child</span><span class="plain-syntax">(</span><span class="identifier-syntax">o</span><span class="plain-syntax">)) </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'M'</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">else</span><span class="plain-syntax">          </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'N'</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">lockable</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">locked</span><span class="plain-syntax">) </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'P'</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">else</span><span class="plain-syntax">                                </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'O'</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    }</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">parenth_flag</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="reserved-syntax">child</span><span class="plain-syntax">(</span><span class="identifier-syntax">o</span><span class="plain-syntax">)==0 &amp;&amp; </span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">transparent</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parenth_flag</span><span class="plain-syntax">) { </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'C'</span><span class="plain-syntax">); </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'F'</span><span class="plain-syntax">); }</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">else</span><span class="plain-syntax">              { </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'A'</span><span class="plain-syntax">); </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'F'</span><span class="plain-syntax">); </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'B'</span><span class="plain-syntax">); }</span>
<span class="plain-syntax">                    }</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parenth_flag</span><span class="plain-syntax">) </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'B'</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">EndActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">PRINTING_INVENTORY_DETAILS_ACT</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }   </span><span class="comment-syntax">end of FULLINV_BIT processing</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">child_count</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">eldest_child</span><span class="plain-syntax"> = </span><span class="reserved-syntax">nothing</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">objectloop</span><span class="plain-syntax"> (</span><span class="identifier-syntax">p</span><span class="plain-syntax"> </span><span class="reserved-syntax">in</span><span class="plain-syntax"> </span><span class="identifier-syntax">o</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">CONCEAL_BIT</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">ConcealedFromLists</span><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">) == </span><span class="reserved-syntax">false</span><span class="plain-syntax">))</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">p</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">list_filter_permits</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">child_count</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">eldest_child</span><span class="plain-syntax"> == </span><span class="reserved-syntax">nothing</span><span class="plain-syntax">) </span><span class="identifier-syntax">eldest_child</span><span class="plain-syntax"> = </span><span class="identifier-syntax">p</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">child_count</span><span class="plain-syntax"> &amp;&amp; (</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">ALWAYS_BIT</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">ENGLISH_BIT</span><span class="plain-syntax">) { </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">" "</span><span class="plain-syntax">; </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'Q'</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">); </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">" "</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">recurse_flag</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">child_count</span><span class="plain-syntax"> &amp;&amp; (</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">RECURSE_BIT</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">supporter</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">ENGLISH_BIT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">TERSE_BIT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'A'</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'R'</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'S'</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">recurse_flag</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">container</span><span class="plain-syntax"> &amp;&amp; (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">open</span><span class="plain-syntax"> || </span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">transparent</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">ENGLISH_BIT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">TERSE_BIT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'A'</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'T'</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'U'</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">recurse_flag</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">recurse_flag</span><span class="plain-syntax"> &amp;&amp; (</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">ENGLISH_BIT</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">SetLWI</span><span class="plain-syntax">(</span><span class="identifier-syntax">child_count</span><span class="plain-syntax">, -1, </span><span class="identifier-syntax">eldest_child</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'V'</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">); </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">" "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">NEWLINE_BIT</span><span class="plain-syntax">) </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">recurse_flag</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">o</span><span class="plain-syntax"> = </span><span class="reserved-syntax">child</span><span class="plain-syntax">(</span><span class="identifier-syntax">o</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">lt_value</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">listing_together</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">listing_size</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">c_iterator</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">c_iterator</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ObjectTreeIterator</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">lt_value</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EMPTY_TEXT_VALUE</span><span class="plain-syntax">; </span><span class="identifier-syntax">listing_together</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="identifier-syntax">listing_size</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WriteListR</span><span class="plain-syntax">(</span><span class="identifier-syntax">o</span><span class="plain-syntax">, </span><span class="identifier-syntax">depth</span><span class="plain-syntax">+1, </span><span class="reserved-syntax">true</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">c_iterator</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">listing_size</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">listing_together</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">lt_value</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c_style</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">TERSE_BIT</span><span class="plain-syntax">) </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax">(</span><span class="character-syntax">'B'</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP26" class="paragraph-anchor"></a><b>&#167;26. Internal Rule.</b>This rule does nothing in itself; it exists as a placeholder for the
response texts used by the list-writer.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">LIST_WRITER_INTERNAL_R</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">+</span><span class="identifier-syntax">replacing</span><span class="plain-syntax">(</span><span class="identifier-syntax">from</span><span class="plain-syntax"> </span><span class="identifier-syntax">BasicInformKit</span><span class="plain-syntax">) [ </span><span class="identifier-syntax">LW_Response</span><span class="plain-syntax"> </span><span class="identifier-syntax">X</span><span class="plain-syntax"> </span><span class="identifier-syntax">o</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">LIST_WRITER_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="identifier-syntax">X</span><span class="plain-syntax">, </span><span class="identifier-syntax">o</span><span class="plain-syntax">);</span>
<span class="plain-syntax">];</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="lght.html">&#10094;</a></li><li class="progresssection"><a href="mscll.html">mscll</a></li><li class="progresssection"><a href="stt.html">stt</a></li><li class="progresssection"><a href="lght.html">lght</a></li><li class="progresscurrent">lstwr</li><li class="progresssection"><a href="ordrf.html">ordrf</a></li><li class="progresssection"><a href="actns.html">actns</a></li><li class="progresssection"><a href="fgrs.html">fgrs</a></li><li class="progresssection"><a href="otfwr.html">otfwr</a></li><li class="progresssection"><a href="prntn.html">prntn</a></li><li class="progresssection"><a href="wrldm.html">wrldm</a></li><li class="progresssection"><a href="mprtf.html">mprtf</a></li><li class="progresssection"><a href="tm.html">tm</a></li><li class="progresssection"><a href="tsts.html">tsts</a></li><li class="progresssection"><a href="chrnl.html">chrnl</a></li><li class="progresssection"><a href="strdc.html">strdc</a></li><li class="progressnext"><a href="ordrf.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

